diff options
65 files changed, 620 insertions, 394 deletions
diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..02e7b95b04 --- /dev/null +++ b/.clang-format @@ -0,0 +1,20 @@ +--- +BasedOnStyle: LLVM +IndentWidth: 4 +--- +Language: Cpp +BasedOnStyle: LLVM +IndentWidth: 4 +AccessModifierOffset: 0 +AlignAfterOpenBracket: Align +#AlignEscapedNewlines: Left +AlignTrailingComments: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: false +ColumnLimit: 100 +#FixNamespaceComments: true +MaxEmptyLinesToKeep: 2 +#CompactNamespaces: true +NamespaceIndentation: None +PointerAlignment: Left diff --git a/README.building-boost b/README.building-boost deleted file mode 100644 index e75ccda692..0000000000 --- a/README.building-boost +++ /dev/null @@ -1,74 +0,0 @@ -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. - -Notice that this is **not** the usual case. If you're using a Linux distribution -shipping a boost version prior to 1.35, you should very strongly consider just -updating to a more recent version. Even CentOS / RedHat 6.9 ship sufficiently -recent versions. Distributions older than that are generally considered to be -end-of-life. - -There are two recommended methods (aside from the far more recommended method of -upgrading your system): Installing boost using the PyBOMBS utility, or building -it from a source tarball. - -1. Installing Boost using PyBOMBS ---------------------------------- - -You can -install a recent boost by downloading and executing the PyBOMBS utility: - -# go to a directory you have write access to -$ git clone git://github.com/pybombs/pybombs -$ cd pybombs -$ ./pybombs install boost - -The utility will take care of everything from thereon, install it from a -package source if a recent version is available for your system or build -it from source if necessary. - -2. Building Boost from a source tarball ---------------------------------------- - -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 (change directory) 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 following 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/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h index 2507f6c375..1cb7947179 100644 --- a/gnuradio-runtime/include/gnuradio/block.h +++ b/gnuradio-runtime/include/gnuradio/block.h @@ -537,17 +537,17 @@ namespace gr { std::vector<float> pc_input_buffers_full_var(); /*! - * \brief Gets instantaneous fullness of \p which input buffer. + * \brief Gets instantaneous fullness of \p which output buffer. */ float pc_output_buffers_full(int which); /*! - * \brief Gets average fullness of \p which input buffer. + * \brief Gets average fullness of \p which output buffer. */ float pc_output_buffers_full_avg(int which); /*! - * \brief Gets variance of fullness of \p which input buffer. + * \brief Gets variance of fullness of \p which output buffer. */ float pc_output_buffers_full_var(int which); diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc index a9eb7921d2..163588682d 100644 --- a/gr-analog/lib/cpm.cc +++ b/gr-analog/lib/cpm.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010,2012,2018 Free Software Foundation, Inc. + * Copyright 2010,2012 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 @@ -29,21 +29,18 @@ #include <cmath> #include <cfloat> -//gives us erf on compilers without it -#include <boost/math/special_functions/erf.hpp> -namespace bm = boost::math; namespace gr { namespace analog { - //! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x + //! Normalised sinc function, sinc(x)=std::sin(pi*x)/pi*x inline double sinc(double x) { if(x == 0) { return 1.0; } - return sin(GR_M_PI * x) / (GR_M_PI * x); + return std::sin(GR_M_PI * x) / (GR_M_PI * x); } @@ -53,7 +50,7 @@ namespace gr { { 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(GR_M_TWOPI * i / L / samples_per_sym); + taps[i] *= 1 - std::cos(GR_M_TWOPI * i / L / samples_per_sym); } return taps; @@ -64,7 +61,7 @@ namespace gr { * * 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) + * g(t) = 1/LT * sinc(2t/LT) * std::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. @@ -72,7 +69,7 @@ namespace gr { * 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) + * g(k) = 1/Ls * sinc(2k/Ls) * std::cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2) * where k = 0...Ls-1 * and s = samples per symbol. */ @@ -93,11 +90,11 @@ namespace gr { // 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] *= GR_M_PI_4; + taps_d[i] *= M_PI_4; } else { double tmp = 4.0 * beta * k / Ls; - taps_d[i] *= cos(beta * GR_M_TWOPI * k / Ls) / (1 - tmp * tmp); + taps_d[i] *= std::cos(beta * GR_M_TWOPI * k / Ls) / (1 - tmp * tmp); } sum += taps_d[i]; } @@ -125,7 +122,7 @@ namespace gr { const double pi2_24 = 0.411233516712057; // pi^2/24 double f = GR_M_PI * k / sps; - return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f); + return sinc(k/sps) - pi2_24 * (2 * std::sin(f) - 2*f*std::cos(f) - f*f*std::sin(f)) / (f*f*f); } //! Taps for TFM CPM (Tamed frequency modulation) @@ -180,8 +177,8 @@ namespace gr { 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))) + taps_d[i] = (std::erf(alpha * (k / samples_per_sym + 0.5)) - + std::erf(alpha * (k / samples_per_sym - 0.5))) * 0.5 / samples_per_sym; taps[i] = (float) taps_d[i]; } diff --git a/gr-blocks/grc/blocks_file_source.xml b/gr-blocks/grc/blocks_file_source.xml index 1f09e95168..e8ebd98706 100644 --- a/gr-blocks/grc/blocks_file_source.xml +++ b/gr-blocks/grc/blocks_file_source.xml @@ -9,7 +9,7 @@ <key>blocks_file_source</key> <import>from gnuradio import blocks</import> <import>import pmt</import> - <make>blocks.file_source($type.size*$vlen, $file, $repeat) + <make>blocks.file_source($type.size*$vlen, $file, $repeat, $offset, $length) self.$(id).set_begin_tag($begin_tag)</make> <callback>open($file, $repeat)</callback> <callback>self.$(id).set_begin_tag($begin_tag)</callback> @@ -76,6 +76,18 @@ self.$(id).set_begin_tag($begin_tag)</make> <value>pmt.PMT_NIL</value> <type>raw</type> </param> + <param> + <name>Offset</name> + <key>offset</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Length</name> + <key>length</key> + <value>0</value> + <type>int</type> + </param> <check>$vlen > 0</check> <source> <name>out</name> diff --git a/gr-blocks/include/gnuradio/blocks/file_source.h b/gr-blocks/include/gnuradio/blocks/file_source.h index c8138339fd..cd73c97d02 100644 --- a/gr-blocks/include/gnuradio/blocks/file_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_source.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012 Free Software Foundation, Inc. + * Copyright 2012, 2018 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -46,32 +46,41 @@ namespace gr { * 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. + * to items. The first \p offset items (default 0) will be + * skipped. * * 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 + * If \p len is non-zero, only items [offset, offset+len) will + * be produced. + * + * \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 + * \param offset begin this many items into file + * \param len produce only items [offset, offset+len) */ - static sptr make(size_t itemsize, const char *filename, bool repeat = false); + static sptr make(size_t itemsize, const char *filename, bool repeat = false, + size_t offset = 0, size_t len = 0); /*! * \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) + * \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 + * \param filename name of the file to source from + * \param repeat repeat file from start + * \param offset begin this many items into file + * \param len produce only items [offset, offset+len) */ - virtual void open(const char *filename, bool repeat) = 0; + virtual void open(const char *filename, bool repeat, size_t offset = 0, size_t len = 0) = 0; /*! * \brief Close the file handle. diff --git a/gr-blocks/lib/file_source_impl.cc b/gr-blocks/lib/file_source_impl.cc index c077c74fd9..6f4f8fde26 100644 --- a/gr-blocks/lib/file_source_impl.cc +++ b/gr-blocks/lib/file_source_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012 Free Software Foundation, Inc. + * Copyright 2012, 2018 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -39,35 +39,38 @@ #include <io.h> #endif #ifdef O_BINARY -#define OUR_O_BINARY O_BINARY +#define OUR_O_BINARY O_BINARY #else -#define OUR_O_BINARY 0 +#define OUR_O_BINARY 0 #endif // should be handled via configure #ifdef O_LARGEFILE -#define OUR_O_LARGEFILE O_LARGEFILE +#define OUR_O_LARGEFILE O_LARGEFILE #else -#define OUR_O_LARGEFILE 0 +#define OUR_O_LARGEFILE 0 #endif namespace gr { namespace blocks { - file_source::sptr file_source::make(size_t itemsize, const char *filename, bool repeat) + file_source::sptr file_source::make(size_t itemsize, const char *filename, bool repeat, + size_t start_offset_items, size_t length_items) { return gnuradio::get_initial_sptr - (new file_source_impl(itemsize, filename, repeat)); + (new file_source_impl(itemsize, filename, repeat, start_offset_items, length_items)); } - file_source_impl::file_source_impl(size_t itemsize, const char *filename, bool repeat) + file_source_impl::file_source_impl(size_t itemsize, const char *filename, bool repeat, + size_t start_offset_items, size_t length_items) : sync_block("file_source", - io_signature::make(0, 0, 0), - io_signature::make(1, 1, itemsize)), - d_itemsize(itemsize), d_fp(0), d_new_fp(0), d_repeat(repeat), - d_updated(false), d_file_begin(true), d_repeat_cnt(0), - d_add_begin_tag(pmt::PMT_NIL) + io_signature::make(0, 0, 0), + io_signature::make(1, 1, itemsize)), + d_itemsize(itemsize), + d_start_offset_items(start_offset_items), d_length_items(length_items), + d_fp(0), d_new_fp(0), d_repeat(repeat), d_updated(false), + d_file_begin(true), d_repeat_cnt(0), d_add_begin_tag(pmt::PMT_NIL) { - open(filename, repeat); + open(filename, repeat, start_offset_items, length_items); do_update(); std::stringstream str; @@ -86,12 +89,35 @@ namespace gr { bool file_source_impl::seek(long seek_point, int whence) { - return fseek((FILE*)d_fp, seek_point *d_itemsize, whence) == 0; + seek_point += d_start_offset_items; + + switch(whence) { + case SEEK_SET: + break; + case SEEK_CUR: + seek_point += (d_length_items - d_items_remaining); + break; + case SEEK_END: + seek_point = d_length_items - seek_point; + break; + default: + GR_LOG_WARN(d_logger, "bad seek mode"); + return 0; + } + + if ((seek_point < (long)d_start_offset_items) + || (seek_point > (long)(d_start_offset_items+d_length_items-1))) { + GR_LOG_WARN(d_logger, "bad seek point"); + return 0; + } + + return fseek((FILE*)d_fp, seek_point * d_itemsize, SEEK_SET) == 0; } void - file_source_impl::open(const char *filename, bool repeat) + file_source_impl::open(const char *filename, bool repeat, + size_t start_offset_items, size_t length_items) { // obtain exclusive access for duration of this function gr::thread::scoped_lock lock(fp_mutex); @@ -100,33 +126,61 @@ namespace gr { // 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"); + GR_LOG_ERROR(d_logger, boost::format("%s: %s") % filename % strerror(errno)); + throw std::runtime_error("can't open file"); } if(d_new_fp) { - fclose(d_new_fp); - d_new_fp = 0; + 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"); + GR_LOG_ERROR(d_logger, boost::format("%s: %s") % filename % strerror(errno)); + ::close(fd); // don't leak file descriptor if fdopen fails + throw std::runtime_error("can't open file"); } //Check to ensure the file will be consumed according to item size fseek(d_new_fp, 0, SEEK_END); int file_size = ftell(d_new_fp); - rewind (d_new_fp); - //Warn the user if part of the file will not be consumed. - if(file_size % d_itemsize){ - GR_LOG_WARN(d_logger, "WARNING: File will not be fully consumed with the current output type"); + // Make sure there will be at least one item available + if ((file_size / d_itemsize) < (start_offset_items+1)) { + if (start_offset_items) { + GR_LOG_WARN(d_logger, "file is too small for start offset"); + } + else { + GR_LOG_WARN(d_logger, "file is too small"); + } + fclose(d_new_fp); + throw std::runtime_error("file is too small"); + } + + size_t items_available = (file_size / d_itemsize - start_offset_items); + + // If length is not specified, use the remainder of the file. Check alignment at end. + if (length_items == 0) { + length_items = items_available; + if (file_size % d_itemsize){ + GR_LOG_WARN(d_logger, "file size is not a multiple of item size"); + } + } + + // Check specified length. Warn and use available items instead of throwing an exception. + if (length_items > items_available) { + length_items = items_available; + GR_LOG_WARN(d_logger, "file too short, will read fewer than requested items"); } + // Rewind to start offset + fseek(d_new_fp, start_offset_items * d_itemsize, SEEK_SET); + d_updated = true; d_repeat = repeat; + d_start_offset_items = start_offset_items; + d_length_items = length_items; + d_items_remaining = length_items; } void @@ -136,8 +190,8 @@ namespace gr { gr::thread::scoped_lock lock(fp_mutex); if(d_new_fp != NULL) { - fclose(d_new_fp); - d_new_fp = NULL; + fclose(d_new_fp); + d_new_fp = NULL; } d_updated = true; } @@ -146,15 +200,15 @@ namespace gr { file_source_impl::do_update() { if(d_updated) { - gr::thread::scoped_lock lock(fp_mutex); // hold while in scope + gr::thread::scoped_lock lock(fp_mutex); // hold while in scope - if(d_fp) - fclose(d_fp); + if(d_fp) + fclose(d_fp); - d_fp = d_new_fp; // install new file pointer - d_new_fp = 0; - d_updated = false; - d_file_begin = true; + d_fp = d_new_fp; // install new file pointer + d_new_fp = 0; + d_updated = false; + d_file_begin = true; } } @@ -166,60 +220,62 @@ namespace gr { int file_source_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_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"); + throw std::runtime_error("work with file not open"); gr::thread::scoped_lock lock(fp_mutex); // hold for the rest of this function + // No items remaining - all done + if (d_items_remaining == 0) + return WORK_DONE; + while(size) { + // Add stream tag whenever the file starts again if (d_file_begin && d_add_begin_tag != pmt::PMT_NIL) { - add_item_tag(0, nitems_written(0) + noutput_items - size, d_add_begin_tag, pmt::from_long(d_repeat_cnt), _id); + add_item_tag(0, nitems_written(0) + noutput_items - size, + d_add_begin_tag, pmt::from_long(d_repeat_cnt), _id); d_file_begin = false; } - 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 (d_add_begin_tag != pmt::PMT_NIL) { - d_file_begin = true; - d_repeat_cnt++; + size_t nitems_to_read = std::min((size_t)size, d_items_remaining); + + // Since the bounds of the file are known, unexpected nitems is an error + if (nitems_to_read != fread(o, d_itemsize, nitems_to_read, (FILE*)d_fp)) + throw std::runtime_error("fread error"); + + size -= nitems_to_read; + d_items_remaining -= nitems_to_read; + o += nitems_to_read * d_itemsize; + + // Ran out of items ("EOF") + if (d_items_remaining == 0) { + + // Repeat: rewind and request tag + if (d_repeat) { + fseek(d_fp, d_start_offset_items * d_itemsize, SEEK_SET); + d_items_remaining = d_length_items; + if (d_add_begin_tag != pmt::PMT_NIL) { + d_file_begin = true; + d_repeat_cnt++; + } + } + + // No repeat: return + else { + break; + } } } - 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; + return (noutput_items - size); } } /* namespace blocks */ diff --git a/gr-blocks/lib/file_source_impl.h b/gr-blocks/lib/file_source_impl.h index 19f393fc1d..6de3fc0d16 100644 --- a/gr-blocks/lib/file_source_impl.h +++ b/gr-blocks/lib/file_source_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012 Free Software Foundation, Inc. + * Copyright 2012, 2018 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -33,6 +33,9 @@ namespace gr { { private: size_t d_itemsize; + size_t d_start_offset_items; + size_t d_length_items; + size_t d_items_remaining; FILE *d_fp; FILE *d_new_fp; bool d_repeat; @@ -47,16 +50,17 @@ namespace gr { void do_update(); public: - file_source_impl(size_t itemsize, const char *filename, bool repeat); + file_source_impl(size_t itemsize, const char *filename, bool repeat, + size_t offset, size_t len); ~file_source_impl(); bool seek(long seek_point, int whence); - void open(const char *filename, bool repeat); + void open(const char *filename, bool repeat, size_t offset, size_t len); void close(); int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); void set_begin_tag(pmt::pmt_t val); }; diff --git a/gr-blocks/lib/stream_pdu_base.h b/gr-blocks/lib/stream_pdu_base.h index 6a2bf9b15e..e15aec1787 100644 --- a/gr-blocks/lib/stream_pdu_base.h +++ b/gr-blocks/lib/stream_pdu_base.h @@ -24,6 +24,7 @@ #define INCLUDED_STREAM_PDU_BASE_H #include <gnuradio/thread/thread.h> +#include <gnuradio/basic_block.h> #include <pmt/pmt.h> class basic_block; diff --git a/gr-blocks/python/blocks/qa_file_descriptor_source_sink.py b/gr-blocks/python/blocks/qa_file_descriptor_source_sink.py new file mode 100644 index 0000000000..c84a82d59f --- /dev/null +++ b/gr-blocks/python/blocks/qa_file_descriptor_source_sink.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# +# Copyright 2018 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along 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, blocks +import os +import tempfile +import pmt + +class test_file_descriptor_source_sink(gr_unittest.TestCase): + + def setUp (self): + os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_file_descriptor(self): + src_data = range(1000) + expected_result = range(1000) + + snk2 = blocks.vector_sink_f() + + with tempfile.NamedTemporaryFile() as temp: + fhandle0 = open(temp.name, "wb") + fd0 = fhandle0.fileno() + + src = blocks.vector_source_f(src_data) + snk = blocks.file_descriptor_sink(gr.sizeof_float, fd0) + + self.tb.connect(src, snk) + self.tb.run() + os.fsync(fd0) + fhandle0.close() + + fhandle1 = open(temp.name, "rb") + fd1 = fhandle1.fileno() + src2 = blocks.file_descriptor_source(gr.sizeof_float, fd1, False) + + self.tb.disconnect(src, snk) + self.tb.connect(src2, snk2) + self.tb.run() + os.fsync(fd1) + fhandle1.close() + + result_data = snk2.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data) + self.assertEqual(len(snk2.tags()), 0) + +if __name__ == '__main__': + gr_unittest.run(test_file_descriptor_source_sink, "test_file_descriptor_source_sink.xml") diff --git a/gr-blocks/python/blocks/qa_file_sink.py b/gr-blocks/python/blocks/qa_file_sink.py new file mode 100644 index 0000000000..a7296183ef --- /dev/null +++ b/gr-blocks/python/blocks/qa_file_sink.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# Copyright 2018 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along 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, blocks +import os +import tempfile +import pmt +import array + +class test_file_sink(gr_unittest.TestCase): + + def setUp (self): + os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_file_sink(self): + data = range(1000) + expected_result = data + + with tempfile.NamedTemporaryFile() as temp: + src = blocks.vector_source_f(data) + snk = blocks.file_sink(gr.sizeof_float, temp.name) + snk.set_unbuffered(True) + self.tb.connect(src, snk) + self.tb.run() + + # Check file length (float: 4 * nsamples) + st = os.stat(temp.name) + self.assertEqual(st.st_size, 4 * len(data)) + + # Check file contents + datafile = open(temp.name, 'r') + result_data = array.array('f') + result_data.fromfile(datafile, len(data)) + self.assertFloatTuplesAlmostEqual(expected_result, result_data) + +if __name__ == '__main__': + gr_unittest.run(test_file_sink, "test_file_sink.xml") diff --git a/gr-blocks/python/blocks/qa_file_source.py b/gr-blocks/python/blocks/qa_file_source.py new file mode 100644 index 0000000000..f8ca75d79c --- /dev/null +++ b/gr-blocks/python/blocks/qa_file_source.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +# +# Copyright 2018 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along 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, blocks +import os +import tempfile +import pmt +import array + +class test_file_source(gr_unittest.TestCase): + + @classmethod + def setUpClass(cls): + os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' + cls._datafile = tempfile.NamedTemporaryFile() + cls._datafilename = cls._datafile.name + cls._vector = range(1000) + with open(cls._datafilename, 'w') as f: + array.array('f', cls._vector).tofile(f) + + @classmethod + def tearDownClass(cls): + del cls._vector + del cls._datafilename + del cls._datafile + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_file_source(self): + expected_result = self._vector + + src = blocks.file_source(gr.sizeof_float, self._datafilename) + snk = blocks.vector_sink_f() + self.tb.connect(src, snk) + self.tb.run() + + result_data = snk.data() + self.assertFloatTuplesAlmostEqual(self._vector, result_data) + self.assertEqual(len(snk.tags()), 0) + + def test_file_source_no_such_file(self): + + try: + src = blocks.file_source(gr.sizeof_float, "___no_such_file___") + self.assertTrue(False) + except RuntimeError, e: + self.assertTrue(True) + + def test_file_source_with_offset(self): + expected_result = self._vector[100:] + + src = blocks.file_source(gr.sizeof_float, self._datafilename, offset=100) + snk = blocks.vector_sink_f() + + self.tb.connect(src, snk) + self.tb.run() + + result_data = snk.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data) + self.assertEqual(len(snk.tags()), 0) + + def test_source_with_offset_and_len(self): + expected_result = self._vector[100:100+600] + + src = blocks.file_source(gr.sizeof_float, self._datafilename, offset=100, len=600) + snk = blocks.vector_sink_f() + self.tb.connect(src, snk) + self.tb.run() + + result_data = snk.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data) + self.assertEqual(len(snk.tags()), 0) + + def test_file_source_can_seek_after_open(self): + + src = blocks.file_source(gr.sizeof_float, self._datafilename) + self.assertTrue(src.seek(0, os.SEEK_SET)) + self.assertTrue(src.seek(len(self._vector)-1, os.SEEK_SET)) + # Seek past end of file - this will also log a warning + self.assertFalse(src.seek(len(self._vector), os.SEEK_SET)) + # Negative seek - this will also log a warning + self.assertFalse(src.seek(-1, os.SEEK_SET)) + + self.assertTrue(src.seek(1, os.SEEK_END)) + self.assertTrue(src.seek(len(self._vector), os.SEEK_END)) + # Seek past end of file - this will also log a warning + self.assertFalse(src.seek(0, os.SEEK_END)) + + self.assertTrue(src.seek(0, os.SEEK_SET)) + self.assertTrue(src.seek(1, os.SEEK_CUR)) + # Seek past end of file - this will also log a warning + self.assertFalse(src.seek(len(self._vector), os.SEEK_CUR)); + + + def test_begin_tag(self): + expected_result = self._vector + + src = blocks.file_source(gr.sizeof_float, self._datafilename) + src.set_begin_tag(pmt.string_to_symbol("file_begin")) + snk = blocks.vector_sink_f() + self.tb.connect(src, snk) + self.tb.run() + + result_data = snk.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data) + self.assertEqual(len(snk.tags()), 1) + + def test_begin_tag_repeat(self): + expected_result = self._vector + self._vector + + src = blocks.file_source(gr.sizeof_float, self._datafilename, True) + src.set_begin_tag(pmt.string_to_symbol("file_begin")) + hd = blocks.head(gr.sizeof_float, 2 * len(self._vector)) + snk = blocks.vector_sink_f() + self.tb.connect(src, hd, snk) + self.tb.run() + + result_data = snk.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data) + tags = snk.tags() + self.assertEqual(len(tags), 2) + self.assertEqual(str(tags[0].key), "file_begin") + self.assertEqual(str(tags[0].value), "0") + self.assertEqual(tags[0].offset, 0) + self.assertEqual(str(tags[1].key), "file_begin") + self.assertEqual(str(tags[1].value), "1") + self.assertEqual(tags[1].offset, 1000) + +if __name__ == '__main__': + gr_unittest.run(test_file_source, "test_file_source.xml") diff --git a/gr-blocks/python/blocks/qa_file_source_sink.py b/gr-blocks/python/blocks/qa_file_source_sink.py deleted file mode 100644 index 32910cb4bc..0000000000 --- a/gr-blocks/python/blocks/qa_file_source_sink.py +++ /dev/null @@ -1,168 +0,0 @@ -#!/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, blocks -import os -import tempfile -import pmt - -class test_file_source_sink(gr_unittest.TestCase): - - def setUp (self): - os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = range(1000) - expected_result = range(1000) - - snk2 = blocks.vector_sink_f() - - with tempfile.NamedTemporaryFile() as temp: - src = blocks.vector_source_f(src_data) - snk = blocks.file_sink(gr.sizeof_float, temp.name) - snk.set_unbuffered(True) - - src2 = blocks.file_source(gr.sizeof_float, temp.name) - - self.tb.connect(src, snk) - self.tb.run() - - self.tb.disconnect(src, snk) - self.tb.connect(src2, snk2) - self.tb.run() - - result_data = snk2.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data) - self.assertEqual(len(snk2.tags()), 0) - - def test_descriptor_001(self): - src_data = range(1000) - expected_result = range(1000) - - snk2 = blocks.vector_sink_f() - - with tempfile.NamedTemporaryFile() as temp: - fhandle0 = open(temp.name, "wb") - fd0 = fhandle0.fileno() - - src = blocks.vector_source_f(src_data) - snk = blocks.file_descriptor_sink(gr.sizeof_float, fd0) - - self.tb.connect(src, snk) - self.tb.run() - os.fsync(fd0) - fhandle0.close() - - fhandle1 = open(temp.name, "rb") - fd1 = fhandle1.fileno() - src2 = blocks.file_descriptor_source(gr.sizeof_float, fd1, False) - - self.tb.disconnect(src, snk) - self.tb.connect(src2, snk2) - self.tb.run() - os.fsync(fd1) - fhandle1.close() - - result_data = snk2.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data) - self.assertEqual(len(snk2.tags()), 0) - - def test_file_source_can_seek_after_open(self): - src_data = range(1000) - - with tempfile.NamedTemporaryFile() as temp: - src = blocks.vector_source_f(src_data) - snk = blocks.file_sink(gr.sizeof_float, temp.name) - snk.set_unbuffered(True) - - self.tb.connect(src, snk) - self.tb.run() - - source = blocks.file_source(gr.sizeof_float, temp.name) - self.assertTrue(source.seek(0, os.SEEK_SET)) - - def test_begin_tag(self): - src_data = range(1000) - expected_result = range(1000) - - snk2 = blocks.vector_sink_f() - - with tempfile.NamedTemporaryFile() as temp: - src = blocks.vector_source_f(src_data) - snk = blocks.file_sink(gr.sizeof_float, temp.name) - snk.set_unbuffered(True) - - src2 = blocks.file_source(gr.sizeof_float, temp.name) - src2.set_begin_tag(pmt.string_to_symbol("file_begin")) - - self.tb.connect(src, snk) - self.tb.run() - - self.tb.disconnect(src, snk) - self.tb.connect(src2, snk2) - self.tb.run() - - result_data = snk2.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data) - self.assertEqual(len(snk2.tags()), 1) - - def test_begin_tag_repeat(self): - src_data = range(1000) - expected_result = range(1000) - expected_result.extend(range(1000)) - - snk2 = blocks.vector_sink_f() - - with tempfile.NamedTemporaryFile() as temp: - src = blocks.vector_source_f(src_data) - snk = blocks.file_sink(gr.sizeof_float, temp.name) - snk.set_unbuffered(True) - - src2 = blocks.file_source(gr.sizeof_float, temp.name, True) - src2.set_begin_tag(pmt.string_to_symbol("file_begin")) - hd = blocks.head(gr.sizeof_float, 2000) - - self.tb.connect(src, snk) - self.tb.run() - - self.tb.disconnect(src, snk) - self.tb.connect(src2, hd, snk2) - self.tb.run() - - result_data = snk2.data() - self.assertFloatTuplesAlmostEqual(expected_result, result_data) - tags = snk2.tags() - self.assertEqual(len(tags), 2) - self.assertEqual(str(tags[0].key), "file_begin") - self.assertEqual(str(tags[0].value), "0") - self.assertEqual(tags[0].offset, 0) - self.assertEqual(str(tags[1].key), "file_begin") - self.assertEqual(str(tags[1].value), "1") - self.assertEqual(tags[1].offset, 1000) - -if __name__ == '__main__': - gr_unittest.run(test_file_source_sink, "test_file_source_sink.xml") - diff --git a/gr-fec/include/gnuradio/fec/polar_common.h b/gr-fec/include/gnuradio/fec/polar_common.h index 229dc70e2e..79272cb308 100644 --- a/gr-fec/include/gnuradio/fec/polar_common.h +++ b/gr-fec/include/gnuradio/fec/polar_common.h @@ -25,6 +25,7 @@ #define INCLUDED_FEC_POLAR_COMMON_H #include <gnuradio/fec/api.h> +#include <vector> // Forward declaration for those objects. SWIG doesn't like them to be #include'd. namespace gr { diff --git a/gr-fec/lib/polar_decoder_common.cc b/gr-fec/lib/polar_decoder_common.cc index 1d4a21a191..9d632110f4 100644 --- a/gr-fec/lib/polar_decoder_common.cc +++ b/gr-fec/lib/polar_decoder_common.cc @@ -125,7 +125,7 @@ namespace gr { polar_decoder_common::butterfly_volk(float* llrs, unsigned char* u, const int stage, const int u_num, const int row) { - volk_32f_8u_polarbutterfly_32f(llrs, u, block_size(), block_power(), stage, u_num, row); + volk_32f_8u_polarbutterfly_32f(llrs, u, block_power(), stage, u_num, row); } diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index 0cbb6f5f51..a55c89369e 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -24,6 +24,7 @@ #define SPECTRUM_GUI_CLASS_CPP #include <gnuradio/qtgui/SpectrumGUIClass.h> + //Added by qt3to4: #include <QEvent> #include <volk/volk.h> diff --git a/gr-qtgui/lib/ber_sink_b_impl.cc b/gr-qtgui/lib/ber_sink_b_impl.cc index eb3aa14597..c0629d5b99 100644 --- a/gr-qtgui/lib/ber_sink_b_impl.cc +++ b/gr-qtgui/lib/ber_sink_b_impl.cc @@ -21,11 +21,12 @@ */ #include "ber_sink_b_impl.h" -#include <boost/math/special_functions/erf.hpp> + #include <gnuradio/io_signature.h> #include <gnuradio/math.h> #include <gnuradio/fft/fft.h> #include <volk/volk.h> +#include <cmath> #ifdef HAVE_CONFIG_H #include <config.h> @@ -90,7 +91,7 @@ namespace gr { for(size_t i = 0; i < esnos.size(); i++) { double e = pow(10.0, esnos[i]/10.0); d_esno_buffers[curves][i] = esnos[i]; - d_ber_buffers[curves][i] = log10(0.5*boost::math::erfc(sqrt(e))); + d_ber_buffers[curves][i] = std::log10(0.5*std::erf(std::sqrt(e))); } @@ -336,7 +337,7 @@ namespace gr { if(d_total_errors[j * d_nconnections + i] >= d_ber_min_errors) { done++; } - else if(log10(((double)d_ber_min_errors)/(d_total[j * d_nconnections + i] * 8.0)) < d_ber_limit) { + else if(std::log10(((double)d_ber_min_errors)/(d_total[j * d_nconnections + i] * 8.0)) < d_ber_limit) { maxed++; } } @@ -354,7 +355,7 @@ namespace gr { for(unsigned int i = 0; i < ninput_items.size(); i += 2) { if((d_total_errors[i >> 1] < d_ber_min_errors) && \ - (log10(((double)d_ber_min_errors)/(d_total[i >> 1] * 8.0)) >= d_ber_limit)) { + (std::log10(((double)d_ber_min_errors)/(d_total[i >> 1] * 8.0)) >= d_ber_limit)) { int items = ninput_items[i] <= ninput_items[i+1] ? ninput_items[i] : ninput_items[i+1]; @@ -370,7 +371,7 @@ namespace gr { d_total[i >> 1] += items; - ber = log10(((double)d_total_errors[i >> 1])/(d_total[i >> 1] * 8.0)); + ber = std::log10(((double)d_total_errors[i >> 1])/(d_total[i >> 1] * 8.0)); d_ber_buffers[i/(d_nconnections * 2)][(i%(d_nconnections * 2)) >> 1] = ber; } @@ -381,7 +382,7 @@ namespace gr { GR_LOG_INFO(d_logger, boost::format(" %1% over %2% --> %3%") \ % d_total_errors[i >> 1] % (d_total[i >> 1] * 8) % ber); } - else if(log10(((double)d_ber_min_errors)/(d_total[i >> 1] * 8.0)) < d_ber_limit) { + else if(std::log10(((double)d_ber_min_errors)/(d_total[i >> 1] * 8.0)) < d_ber_limit) { GR_LOG_INFO(d_logger, "BER Limit Reached"); d_ber_buffers[i/(d_nconnections * 2)][(i%(d_nconnections * 2)) >> 1] = d_ber_limit; d_total_errors[i >> 1] = d_ber_min_errors + 1; diff --git a/gr-qtgui/lib/ber_sink_b_impl.h b/gr-qtgui/lib/ber_sink_b_impl.h index 5ae637699e..23957230ed 100644 --- a/gr-qtgui/lib/ber_sink_b_impl.h +++ b/gr-qtgui/lib/ber_sink_b_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_BER_SINK_B_IMPL_H #include <gnuradio/qtgui/ber_sink_b.h> + #include <gnuradio/high_res_timer.h> #include <gnuradio/qtgui/constellationdisplayform.h> diff --git a/gr-qtgui/lib/const_sink_c_impl.cc b/gr-qtgui/lib/const_sink_c_impl.cc index 3f3bbf4405..7cfd689189 100644 --- a/gr-qtgui/lib/const_sink_c_impl.cc +++ b/gr-qtgui/lib/const_sink_c_impl.cc @@ -25,6 +25,7 @@ #endif #include "const_sink_c_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> #include <string.h> diff --git a/gr-qtgui/lib/const_sink_c_impl.h b/gr-qtgui/lib/const_sink_c_impl.h index f2dcb6e73e..54fa39f27d 100644 --- a/gr-qtgui/lib/const_sink_c_impl.h +++ b/gr-qtgui/lib/const_sink_c_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_CONST_SINK_C_IMPL_H #include <gnuradio/qtgui/const_sink_c.h> + #include <gnuradio/high_res_timer.h> #include <gnuradio/qtgui/constellationdisplayform.h> diff --git a/gr-qtgui/lib/constellationdisplayform.cc b/gr-qtgui/lib/constellationdisplayform.cc index 1325beccae..bc70bb92d2 100644 --- a/gr-qtgui/lib/constellationdisplayform.cc +++ b/gr-qtgui/lib/constellationdisplayform.cc @@ -20,9 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#include <gnuradio/qtgui/constellationdisplayform.h> + #include <cmath> #include <QMessageBox> -#include <gnuradio/qtgui/constellationdisplayform.h> #include <iostream> ConstellationDisplayForm::ConstellationDisplayForm(int nplots, QWidget* parent) diff --git a/gr-qtgui/lib/displayform.cc b/gr-qtgui/lib/displayform.cc index 13c2d8a193..d4e86b1768 100644 --- a/gr-qtgui/lib/displayform.cc +++ b/gr-qtgui/lib/displayform.cc @@ -21,6 +21,7 @@ */ #include <gnuradio/qtgui/displayform.h> + #include <iostream> #include <QPixmap> #include <QFileDialog> diff --git a/gr-qtgui/lib/edit_box_msg_impl.cc b/gr-qtgui/lib/edit_box_msg_impl.cc index 0dee1fa18b..7050c74985 100644 --- a/gr-qtgui/lib/edit_box_msg_impl.cc +++ b/gr-qtgui/lib/edit_box_msg_impl.cc @@ -25,9 +25,11 @@ #endif #include "edit_box_msg_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> #include <gnuradio/qtgui/utils.h> + #include <boost/lexical_cast.hpp> namespace gr { diff --git a/gr-qtgui/lib/edit_box_msg_impl.h b/gr-qtgui/lib/edit_box_msg_impl.h index c60b3de9b0..0e16f958a7 100644 --- a/gr-qtgui/lib/edit_box_msg_impl.h +++ b/gr-qtgui/lib/edit_box_msg_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_EDIT_BOX_MSG_IMPL_H #include <gnuradio/qtgui/edit_box_msg.h> + #include <QGroupBox> #include <QVBoxLayout> #include <QHBoxLayout> diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc index c697e8c269..afd4f91d98 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -25,12 +25,15 @@ #endif #include "freq_sink_c_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> #include <qwt_symbol.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h index b102209359..9dcde0887e 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.h +++ b/gr-qtgui/lib/freq_sink_c_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_FREQ_SINK_C_IMPL_H #include <gnuradio/qtgui/freq_sink_c.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc index 046414ffaf..c131b89bf6 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -25,12 +25,15 @@ #endif #include "freq_sink_f_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> #include <qwt_symbol.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/freq_sink_f_impl.h b/gr-qtgui/lib/freq_sink_f_impl.h index 85d45b3f4c..782bdb5626 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.h +++ b/gr-qtgui/lib/freq_sink_f_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_FREQ_SINK_F_IMPL_H #include <gnuradio/qtgui/freq_sink_f.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/freqcontrolpanel.cc b/gr-qtgui/lib/freqcontrolpanel.cc index c0a8ed4158..536bf9a2f8 100644 --- a/gr-qtgui/lib/freqcontrolpanel.cc +++ b/gr-qtgui/lib/freqcontrolpanel.cc @@ -21,6 +21,7 @@ */ #include <gnuradio/qtgui/freqcontrolpanel.h> + #include <cmath> FreqControlPanel::FreqControlPanel(FreqDisplayForm *form) diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc index 832a16c783..613138d13a 100644 --- a/gr-qtgui/lib/freqdisplayform.cc +++ b/gr-qtgui/lib/freqdisplayform.cc @@ -20,10 +20,11 @@ * Boston, MA 02110-1301, USA. */ +#include <gnuradio/qtgui/freqdisplayform.h> + #include <cmath> #include <QMessageBox> #include <QSpacerItem> -#include <gnuradio/qtgui/freqdisplayform.h> #include <gnuradio/qtgui/freqcontrolpanel.h> #include <iostream> diff --git a/gr-qtgui/lib/histogram_sink_f_impl.cc b/gr-qtgui/lib/histogram_sink_f_impl.cc index 13e50b217c..c08df37e7d 100644 --- a/gr-qtgui/lib/histogram_sink_f_impl.cc +++ b/gr-qtgui/lib/histogram_sink_f_impl.cc @@ -25,12 +25,15 @@ #endif #include "histogram_sink_f_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> #include <qwt_symbol.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/histogram_sink_f_impl.h b/gr-qtgui/lib/histogram_sink_f_impl.h index d397beeb6b..27c0017915 100644 --- a/gr-qtgui/lib/histogram_sink_f_impl.h +++ b/gr-qtgui/lib/histogram_sink_f_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_HISTOGRAM_SINK_F_IMPL_H #include <gnuradio/qtgui/histogram_sink_f.h> + #include <gnuradio/qtgui/histogramdisplayform.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/histogramdisplayform.cc b/gr-qtgui/lib/histogramdisplayform.cc index 9cff21f11d..905a8635b0 100644 --- a/gr-qtgui/lib/histogramdisplayform.cc +++ b/gr-qtgui/lib/histogramdisplayform.cc @@ -20,9 +20,11 @@ * Boston, MA 02110-1301, USA. */ -#include <cmath> -#include <QMessageBox> #include <gnuradio/qtgui/histogramdisplayform.h> + +#include <QMessageBox> + +#include <cmath> #include <iostream> HistogramDisplayForm::HistogramDisplayForm(int nplots, QWidget* parent) diff --git a/gr-qtgui/lib/number_sink_impl.cc b/gr-qtgui/lib/number_sink_impl.cc index ea07c5dbd2..129e6462f3 100644 --- a/gr-qtgui/lib/number_sink_impl.cc +++ b/gr-qtgui/lib/number_sink_impl.cc @@ -25,11 +25,14 @@ #endif #include "number_sink_impl.h" + #include <gnuradio/io_signature.h> -#include <string.h> -#include <volk/volk.h> #include <gnuradio/fft/fft.h> + +#include <volk/volk.h> #include <qwt_symbol.h> + +#include <string.h> #include <cmath> #ifdef _MSC_VER diff --git a/gr-qtgui/lib/number_sink_impl.h b/gr-qtgui/lib/number_sink_impl.h index a5809354fa..e17d409f32 100644 --- a/gr-qtgui/lib/number_sink_impl.h +++ b/gr-qtgui/lib/number_sink_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_NUMBER_SINK_IMPL_H #include <gnuradio/qtgui/number_sink.h> + #include <gnuradio/qtgui/numberdisplayform.h> #include <gnuradio/filter/single_pole_iir.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/numberdisplayform.cc b/gr-qtgui/lib/numberdisplayform.cc index a199c35d4e..33b5076be0 100644 --- a/gr-qtgui/lib/numberdisplayform.cc +++ b/gr-qtgui/lib/numberdisplayform.cc @@ -20,12 +20,14 @@ * Boston, MA 02110-1301, USA. */ -#include <cmath> +#include <gnuradio/qtgui/numberdisplayform.h> + +#include <qwt_color_map.h> #include <QMessageBox> #include <QFileDialog> -#include <gnuradio/qtgui/numberdisplayform.h> + +#include <cmath> #include <iostream> -#include <qwt_color_map.h> NumberDisplayForm::NumberDisplayForm(int nplots, gr::qtgui::graph_t type, QWidget* parent) diff --git a/gr-qtgui/lib/plot_raster.cc b/gr-qtgui/lib/plot_raster.cc index b40513506d..f565977d5b 100644 --- a/gr-qtgui/lib/plot_raster.cc +++ b/gr-qtgui/lib/plot_raster.cc @@ -20,14 +20,16 @@ * Boston, MA 02110-1301, USA. */ -#include <iostream> +#include <gnuradio/qtgui/plot_raster.h> + #include <qimage.h> #include <qpen.h> #include <qpainter.h> #include "qwt_painter.h" #include "qwt_scale_map.h" #include "qwt_color_map.h" -#include <gnuradio/qtgui/plot_raster.h> + +#include <iostream> #if QWT_VERSION < 0x060000 #include "qwt_double_interval.h" diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc index b96d573e3d..ccc4b74c4b 100644 --- a/gr-qtgui/lib/plot_waterfall.cc +++ b/gr-qtgui/lib/plot_waterfall.cc @@ -20,13 +20,14 @@ * Boston, MA 02110-1301, USA. */ +#include <gnuradio/qtgui/plot_waterfall.h> + #include <qimage.h> #include <qpen.h> #include <qpainter.h> #include "qwt_painter.h" #include "qwt_scale_map.h" #include "qwt_color_map.h" -#include <gnuradio/qtgui/plot_waterfall.h> #if QWT_VERSION < 0x060000 #include "qwt_double_interval.h" diff --git a/gr-qtgui/lib/qtgui_util.cc b/gr-qtgui/lib/qtgui_util.cc index 0a0c826bbe..4201022f40 100644 --- a/gr-qtgui/lib/qtgui_util.cc +++ b/gr-qtgui/lib/qtgui_util.cc @@ -21,7 +21,9 @@ */ #include <gnuradio/qtgui/utils.h> + #include <gnuradio/prefs.h> + #include <QDebug> #include <QFile> #include <QCoreApplication> diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc index ba1be4b7c3..958a155b52 100644 --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -25,11 +25,14 @@ #endif #include "sink_c_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/sink_c_impl.h b/gr-qtgui/lib/sink_c_impl.h index 87ce7ad39e..455d215349 100644 --- a/gr-qtgui/lib/sink_c_impl.h +++ b/gr-qtgui/lib/sink_c_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009,2011,2012,2014 Free Software Foundation, Inc. + * Copyright 2008,2009,2011,2012,2014,2018 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_SINK_C_IMPL_H #include <gnuradio/qtgui/sink_c.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc index 73b6fcad83..2c1eaf2a92 100644 --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -25,11 +25,14 @@ #endif #include "sink_f_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/sink_f_impl.h b/gr-qtgui/lib/sink_f_impl.h index 53494b9ccf..bd72e47b29 100644 --- a/gr-qtgui/lib/sink_f_impl.h +++ b/gr-qtgui/lib/sink_f_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_SINK_F_IMPL_H #include <gnuradio/qtgui/sink_f.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 8c67b7a2bf..fcc6561f3b 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -19,12 +19,14 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ +#include <gnuradio/qtgui/spectrumdisplayform.h> + +#include <gnuradio/qtgui/qtgui_types.h> -#include <cmath> #include <QColorDialog> #include <QMessageBox> -#include <gnuradio/qtgui/spectrumdisplayform.h> -#include <gnuradio/qtgui/qtgui_types.h> + +#include <cmath> SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) : QWidget(parent) diff --git a/gr-qtgui/lib/timeRasterGlobalData.cc b/gr-qtgui/lib/timeRasterGlobalData.cc index 018b7e5ea6..18d8b8daef 100644 --- a/gr-qtgui/lib/timeRasterGlobalData.cc +++ b/gr-qtgui/lib/timeRasterGlobalData.cc @@ -24,6 +24,7 @@ #define TIMERASTER_GLOBAL_DATA_CPP #include <gnuradio/qtgui/timeRasterGlobalData.h> + #include <cstdio> #include <cmath> #include <iostream> diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.cc b/gr-qtgui/lib/time_raster_sink_b_impl.cc index 1e2fe360b1..b8e55ae724 100644 --- a/gr-qtgui/lib/time_raster_sink_b_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc @@ -25,11 +25,14 @@ #endif #include "time_raster_sink_b_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.h b/gr-qtgui/lib/time_raster_sink_b_impl.h index 48037b5e5e..1bfe3d68bb 100644 --- a/gr-qtgui/lib/time_raster_sink_b_impl.h +++ b/gr-qtgui/lib/time_raster_sink_b_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_TIME_RASTER_SINK_B_IMPL_H #include <gnuradio/qtgui/time_raster_sink_b.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.cc b/gr-qtgui/lib/time_raster_sink_f_impl.cc index e4cbb0d38f..5b23f98235 100644 --- a/gr-qtgui/lib/time_raster_sink_f_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc @@ -25,11 +25,14 @@ #endif #include "time_raster_sink_f_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.h b/gr-qtgui/lib/time_raster_sink_f_impl.h index 1f25dc5534..31ac460d03 100644 --- a/gr-qtgui/lib/time_raster_sink_f_impl.h +++ b/gr-qtgui/lib/time_raster_sink_f_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_TIME_RASTER_SINK_F_IMPL_H #include <gnuradio/qtgui/time_raster_sink_f.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc index b23a5468fc..89fafb7f5a 100644 --- a/gr-qtgui/lib/time_sink_c_impl.cc +++ b/gr-qtgui/lib/time_sink_c_impl.cc @@ -25,13 +25,16 @@ #endif #include "time_sink_c_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> -#include <volk/volk.h> #include <gnuradio/fft/fft.h> + +#include <volk/volk.h> #include <qwt_symbol.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h index ff938f8ea1..92cda21df1 100644 --- a/gr-qtgui/lib/time_sink_c_impl.h +++ b/gr-qtgui/lib/time_sink_c_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_TIME_SINK_C_IMPL_H #include <gnuradio/qtgui/time_sink_c.h> + #include <gnuradio/qtgui/timedisplayform.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc index 2b39b5536c..a1af17cfb5 100644 --- a/gr-qtgui/lib/time_sink_f_impl.cc +++ b/gr-qtgui/lib/time_sink_f_impl.cc @@ -25,15 +25,18 @@ #endif #include "time_sink_f_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/block_detail.h> #include <gnuradio/buffer.h> #include <gnuradio/prefs.h> -#include <string.h> -#include <volk/volk.h> #include <gnuradio/fft/fft.h> + +#include <volk/volk.h> #include <qwt_symbol.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h index a7a304aee1..094c96efab 100644 --- a/gr-qtgui/lib/time_sink_f_impl.h +++ b/gr-qtgui/lib/time_sink_f_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_TIME_SINK_F_IMPL_H #include <gnuradio/qtgui/time_sink_f.h> + #include <gnuradio/qtgui/timedisplayform.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc index 726944101d..efb8a4f9fd 100644 --- a/gr-qtgui/lib/timedisplayform.cc +++ b/gr-qtgui/lib/timedisplayform.cc @@ -19,13 +19,15 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ +#include <gnuradio/qtgui/timecontrolpanel.h> + +#include <gnuradio/qtgui/timedisplayform.h> -#include <cmath> #include <QMessageBox> #include <QSpacerItem> #include <QGroupBox> -#include <gnuradio/qtgui/timedisplayform.h> -#include <gnuradio/qtgui/timecontrolpanel.h> + +#include <cmath> #include <iostream> diff --git a/gr-qtgui/lib/timerasterdisplayform.cc b/gr-qtgui/lib/timerasterdisplayform.cc index 9582f02973..5b1d8f5e37 100644 --- a/gr-qtgui/lib/timerasterdisplayform.cc +++ b/gr-qtgui/lib/timerasterdisplayform.cc @@ -20,10 +20,12 @@ * Boston, MA 02110-1301, USA. */ -#include <cmath> +#include <gnuradio/qtgui/timerasterdisplayform.h> + #include <QColorDialog> #include <QMessageBox> -#include <gnuradio/qtgui/timerasterdisplayform.h> + +#include <cmath> #include <iostream> TimeRasterDisplayForm::TimeRasterDisplayForm(int nplots, diff --git a/gr-qtgui/lib/vector_sink_f_impl.cc b/gr-qtgui/lib/vector_sink_f_impl.cc index fedef9654d..ca6a8c3054 100644 --- a/gr-qtgui/lib/vector_sink_f_impl.cc +++ b/gr-qtgui/lib/vector_sink_f_impl.cc @@ -25,12 +25,15 @@ #endif #include "vector_sink_f_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> #include <qwt_symbol.h> +#include <string.h> + namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/vector_sink_f_impl.h b/gr-qtgui/lib/vector_sink_f_impl.h index 12cf362fee..6abd61d170 100644 --- a/gr-qtgui/lib/vector_sink_f_impl.h +++ b/gr-qtgui/lib/vector_sink_f_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_VECTOR_SINK_F_IMPL_H #include <gnuradio/qtgui/vector_sink_f.h> + #include <gnuradio/high_res_timer.h> #include <gnuradio/qtgui/vectordisplayform.h> diff --git a/gr-qtgui/lib/vectordisplayform.cc b/gr-qtgui/lib/vectordisplayform.cc index 7eb5c45d0a..d1a5882d3e 100644 --- a/gr-qtgui/lib/vectordisplayform.cc +++ b/gr-qtgui/lib/vectordisplayform.cc @@ -20,9 +20,11 @@ * Boston, MA 02110-1301, USA. */ -#include <cmath> -#include <QMessageBox> #include <gnuradio/qtgui/vectordisplayform.h> + +#include <QMessageBox> + +#include <cmath> #include <iostream> VectorDisplayForm::VectorDisplayForm(int nplots, QWidget* parent) diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index 5d500e51ae..09d8b7efd2 100644 --- a/gr-qtgui/lib/waterfallGlobalData.cc +++ b/gr-qtgui/lib/waterfallGlobalData.cc @@ -24,6 +24,7 @@ #define WATERFALL_GLOBAL_DATA_CPP #include <gnuradio/qtgui/waterfallGlobalData.h> + #include <cstdio> WaterfallData::WaterfallData(const double minimumFrequency, diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc b/gr-qtgui/lib/waterfall_sink_c_impl.cc index 4306b97d71..50611dccc6 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc @@ -25,12 +25,15 @@ #endif #include "waterfall_sink_c_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> #include <qwt_symbol.h> + #include <iostream> +#include <string.h> namespace gr { namespace qtgui { diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.h b/gr-qtgui/lib/waterfall_sink_c_impl.h index 49766cd3dc..c6e7236c37 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.h +++ b/gr-qtgui/lib/waterfall_sink_c_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_WATERFALL_SINK_C_IMPL_H #include <gnuradio/qtgui/waterfall_sink_c.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc b/gr-qtgui/lib/waterfall_sink_f_impl.cc index 9789c2cf6d..f1df670029 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc @@ -25,10 +25,13 @@ #endif #include "waterfall_sink_f_impl.h" + #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> -#include <string.h> + #include <volk/volk.h> + +#include <string.h> #include <iostream> namespace gr { diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.h b/gr-qtgui/lib/waterfall_sink_f_impl.h index db0f4239bc..fb6fdddc0e 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.h +++ b/gr-qtgui/lib/waterfall_sink_f_impl.h @@ -24,6 +24,7 @@ #define INCLUDED_QTGUI_WATERFALL_SINK_F_IMPL_H #include <gnuradio/qtgui/waterfall_sink_f.h> + #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> diff --git a/gr-qtgui/lib/waterfalldisplayform.cc b/gr-qtgui/lib/waterfalldisplayform.cc index a284c5233a..38ac91b836 100644 --- a/gr-qtgui/lib/waterfalldisplayform.cc +++ b/gr-qtgui/lib/waterfalldisplayform.cc @@ -20,10 +20,12 @@ * Boston, MA 02110-1301, USA. */ -#include <cmath> +#include <gnuradio/qtgui/waterfalldisplayform.h> + #include <QColorDialog> #include <QMessageBox> -#include <gnuradio/qtgui/waterfalldisplayform.h> + +#include <cmath> #include <iostream> WaterfallDisplayForm::WaterfallDisplayForm(int nplots, QWidget* parent) diff --git a/volk b/volk -Subproject a0e406e042ed9cda27333efa2de0fcc10912ea0 +Subproject d2a4c5ce0f1aaae5dbd7939eece3e6892ebb0e1 |