diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | cmake/Modules/GrBoost.cmake | 7 | ||||
-rw-r--r-- | cmake/Modules/GrPlatform.cmake | 8 | ||||
-rw-r--r-- | cmake/msvc/config.h | 4 | ||||
-rw-r--r-- | gnuradio-runtime/lib/pmt/pmt.cc | 12 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx | 2 | ||||
-rw-r--r-- | gr-analog/lib/fastnoise_source_X_impl.cc.t | 4 | ||||
-rw-r--r-- | gr-blocks/lib/ConfigChecks.cmake | 7 | ||||
-rw-r--r-- | gr-blocks/lib/test_tag_variable_rate_ff_impl.cc | 12 | ||||
-rw-r--r-- | gr-digital/lib/msk_timing_recovery_cc_impl.cc | 8 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake | 8 | ||||
-rw-r--r-- | grc/core/utils/epy_block_io.py | 2 | ||||
-rw-r--r-- | grc/gui/ActionHandler.py | 3 |
13 files changed, 65 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ca13431cd5..ba43f97a80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,6 +148,10 @@ if(MSVC) add_definitions(/bigobj) #allow for larger object files endif(MSVC) +if(WIN32) + add_definitions(-D_USE_MATH_DEFINES) +endif(WIN32) + # Record Compiler Info for record STRING(TOUPPER ${CMAKE_BUILD_TYPE} GRCBTU) set(COMPILER_INFO "") diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake index 6e036a5bdc..1cf8e65a11 100644 --- a/cmake/Modules/GrBoost.cmake +++ b/cmake/Modules/GrBoost.cmake @@ -32,14 +32,9 @@ set(BOOST_REQUIRED_COMPONENTS filesystem system regex + thread ) -if (MINGW) - set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread_win32) -else(MINGW) - set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread) -endif(MINGW) - 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") diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake index fbbea5fee0..00a53d04d9 100644 --- a/cmake/Modules/GrPlatform.cmake +++ b/cmake/Modules/GrPlatform.cmake @@ -51,4 +51,12 @@ endif() if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") set(LIB_SUFFIX 64) endif() + +######################################################################## +# Detect /lib versus /lib64 +######################################################################## +if (CMAKE_INSTALL_LIBDIR MATCHES lib64) + set(LIB_SUFFIX 64) +endif() + set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h index 99a2ea0f89..d3daed1587 100644 --- a/cmake/msvc/config.h +++ b/cmake/msvc/config.h @@ -21,7 +21,6 @@ typedef ptrdiff_t ssize_t; //////////////////////////////////////////////////////////////////////// // rint functions //////////////////////////////////////////////////////////////////////// -#define _USE_MATH_DEFINES #include <math.h> #if _MSC_VER < 1800 static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);} @@ -62,7 +61,4 @@ static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x static inline long int random (void) { return rand(); } static inline void srandom (unsigned int seed) { srand(seed); } -#define srand48(seed) srand(seed) -#define drand48() (double(rand()) / RAND_MAX) - #endif // _MSC_CONFIG_H_ ] diff --git a/gnuradio-runtime/lib/pmt/pmt.cc b/gnuradio-runtime/lib/pmt/pmt.cc index 51fb86e58c..e09452e60e 100644 --- a/gnuradio-runtime/lib/pmt/pmt.cc +++ b/gnuradio-runtime/lib/pmt/pmt.cc @@ -281,7 +281,17 @@ string_to_symbol(const std::string &name) if (name == _symbol(sym)->name()) return sym; // Yes. Return it } - + + // Lock the table on insert for thread safety: + static boost::mutex thread_safety; + boost::mutex::scoped_lock lock(thread_safety); + // Re-do the search in case another thread inserted this symbol into the table + // before we got the lock + for (pmt_t sym = (*get_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((*get_symbol_hash_table())[hash]); diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx index cf67584235..15a2153a0f 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx +++ b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx @@ -46,7 +46,7 @@ except ImportError: "Please check that they are installed and try again." sys.exit(1) -from PyQt4 import QtCore,Qt,Qwt5 +from PyQt4 import QtCore,Qt import PyQt4.QtGui as QtGui import itertools diff --git a/gr-analog/lib/fastnoise_source_X_impl.cc.t b/gr-analog/lib/fastnoise_source_X_impl.cc.t index 21f963b65a..940918b11b 100644 --- a/gr-analog/lib/fastnoise_source_X_impl.cc.t +++ b/gr-analog/lib/fastnoise_source_X_impl.cc.t @@ -144,7 +144,7 @@ namespace gr { @TYPE@ @IMPL_NAME@::sample() { -#ifdef __USE_GNU +#ifdef HAVE_RAND48 size_t idx = lrand48() % d_samples.size(); #else size_t idx = rand() % d_samples.size(); @@ -153,7 +153,7 @@ namespace gr { } #ifndef FASTNOISE_RANDOM_SIGN -#ifdef _MSC_VER +#ifndef HAVE_RAND48 #define FASTNOISE_RANDOM_SIGN ((rand()%2==0)?1:-1) #else #define FASTNOISE_RANDOM_SIGN ((lrand48()%2==0)?1:-1) diff --git a/gr-blocks/lib/ConfigChecks.cmake b/gr-blocks/lib/ConfigChecks.cmake index 1effaa8360..222a221dc1 100644 --- a/gr-blocks/lib/ConfigChecks.cmake +++ b/gr-blocks/lib/ConfigChecks.cmake @@ -89,3 +89,10 @@ CHECK_CXX_SOURCE_COMPILES(" " HAVE_COSF ) GR_ADD_COND_DEF(HAVE_COSF) + +CHECK_CXX_SOURCE_COMPILES(" + #include <stdlib.h> + int main(){srand48(0); drand48(); lrand48(); return 0;} + " HAVE_RAND48 +) +GR_ADD_COND_DEF(HAVE_RAND48) diff --git a/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc b/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc index 4927cc1408..ec239c9fa7 100644 --- a/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc +++ b/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc @@ -57,7 +57,11 @@ namespace gr { d_new_in = 0; d_last_out = 0; +#ifdef HAVE_RAND48 srand48(time(NULL)); +#else + srand(time(NULL)); +#endif } test_tag_variable_rate_ff_impl::~test_tag_variable_rate_ff_impl() @@ -78,7 +82,11 @@ namespace gr { GR_LOG_DEBUG(d_logger, boost::format("noutput_items: %1%") % noutput_items); if(d_update_once) { +#ifdef HAVE_RAND48 if(drand48() > 0.5) { +#else + if (rand() > RAND_MAX / 2) { +#endif d_rrate += d_update_step; } else { @@ -95,7 +103,11 @@ namespace gr { while(i < ninput_items[0]) { if(!d_update_once) { +#ifdef HAVE_RAND48 if(drand48() > 0.5) { +#else + if (rand() > RAND_MAX / 2) { +#endif d_rrate += d_update_step; } else { diff --git a/gr-digital/lib/msk_timing_recovery_cc_impl.cc b/gr-digital/lib/msk_timing_recovery_cc_impl.cc index 4b26573870..1473aa88c5 100644 --- a/gr-digital/lib/msk_timing_recovery_cc_impl.cc +++ b/gr-digital/lib/msk_timing_recovery_cc_impl.cc @@ -145,8 +145,16 @@ namespace gr { tags.erase(tags.begin()); goto out; } + if(std::abs(center) >= 1.0f) { + GR_LOG_WARN(d_logger, boost::format("work: ignoring time_est tag " + "(%.2f) outside of (-1, 1)") \ + % center); + tags.erase(tags.begin()); + goto out; + } d_mu = center; iidx = offset; + //we want positive mu, so offset iidx to compensate if(d_mu<0) { d_mu++; iidx--; diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake index fbbea5fee0..00a53d04d9 100644 --- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake @@ -51,4 +51,12 @@ endif() if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") set(LIB_SUFFIX 64) endif() + +######################################################################## +# Detect /lib versus /lib64 +######################################################################## +if (CMAKE_INSTALL_LIBDIR MATCHES lib64) + set(LIB_SUFFIX 64) +endif() + set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/grc/core/utils/epy_block_io.py b/grc/core/utils/epy_block_io.py index 76b50051db..4eb4d6d4e5 100644 --- a/grc/core/utils/epy_block_io.py +++ b/grc/core/utils/epy_block_io.py @@ -19,7 +19,7 @@ def _ports(sigs, msgs): for i, dtype in enumerate(sigs): port_type = TYPE_MAP.get(dtype.name, None) if not port_type: - raise ValueError("Can't map {0:!r} to GRC port type".format(dtype)) + raise ValueError("Can't map {0!r} to GRC port type".format(dtype)) ports.append((str(i), port_type)) for msg_key in msgs: if msg_key == 'system': diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py index ec5ac7c574..b9f534fdf0 100644 --- a/grc/gui/ActionHandler.py +++ b/grc/gui/ActionHandler.py @@ -515,8 +515,9 @@ class ActionHandler: elif action == Actions.FLOW_GRAPH_NEW: main.new_page() if args: + flow_graph = main.get_flow_graph() flow_graph._options_block.get_param('generate_options').set_value(args[0]) - flow_graph_update() + flow_graph_update(flow_graph) elif action == Actions.FLOW_GRAPH_OPEN: file_paths = args if args else OpenFlowGraphFileDialog(page.get_file_path()).run() if file_paths: #open a new page for each file, show only the first |