aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-13 09:22:12 -0800
committerJosh Blum <josh@joshknows.com>2010-02-13 09:22:12 -0800
commit97785c838e088f978c8dd2c4c796cdcbeafebffc (patch)
tree30b6dbbcd145f507cc353df220bf3b80425fdea5
parent51e5396079d8af7cf8287b586ff2351a19ae8381 (diff)
downloaduhd-97785c838e088f978c8dd2c4c796cdcbeafebffc.tar.gz
uhd-97785c838e088f978c8dd2c4c796cdcbeafebffc.tar.bz2
uhd-97785c838e088f978c8dd2c4c796cdcbeafebffc.zip
Compiling under old fedora8 with boost 1.37.
Fixed somethings that caused errors and warnings. Cannot get rid of all warnings on this system.
-rw-r--r--configure.ac4
-rw-r--r--include/uhd/utils.hpp2
-rw-r--r--lib/gain_handler.cpp31
-rw-r--r--lib/usrp/mboard/test.cpp1
-rw-r--r--test/usrp_dboard_test.cpp4
5 files changed, 23 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 18598b2b6..d8c911f47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ AM_INIT_AUTOMAKE(uhd, 0)
## Setup C++ and Libtool
##################################################
AC_PROG_CXX
-LT_INIT
+AC_PROG_LIBTOOL#LT_INIT
##################################################
## Check Boost
@@ -89,7 +89,7 @@ AC_DEFUN([UHD_OPTIONAL_CXXFLAG],[
UHD_OPTIONAL_CXXFLAG([-Wall])
UHD_OPTIONAL_CXXFLAG([-Wextra])
-UHD_OPTIONAL_CXXFLAG([-Werror])
+#UHD_OPTIONAL_CXXFLAG([-Werror])
UHD_OPTIONAL_CXXFLAG([-pedantic])
UHD_OPTIONAL_CXXFLAG([-ansi])
diff --git a/include/uhd/utils.hpp b/include/uhd/utils.hpp
index 13367990e..4c95b4964 100644
--- a/include/uhd/utils.hpp
+++ b/include/uhd/utils.hpp
@@ -89,7 +89,7 @@ inline void tune(
// Calculate the DDC setting that will downconvert the baseband from the
// daughterboard to our target frequency.
freq_t delta_freq = target_freq - inter_freq;
- int delta_sign = std::signum(delta_freq);
+ freq_t delta_sign = std::signum(delta_freq);
delta_freq *= delta_sign;
delta_freq = fmod(delta_freq, dsp_sample_rate);
bool inverted = delta_freq > dsp_sample_rate/2.0;
diff --git a/lib/gain_handler.cpp b/lib/gain_handler.cpp
index 85cacd2a5..b03d5bda2 100644
--- a/lib/gain_handler.cpp
+++ b/lib/gain_handler.cpp
@@ -72,35 +72,40 @@ void gain_handler::_check_key(const wax::obj &key_){
catch(const std::assert_error &){}
}
+static gain_t gain_max(gain_t a, gain_t b){
+ return std::max(a, b);
+}
+static gain_t gain_sum(gain_t a, gain_t b){
+ return std::sum(a, b);
+}
+
bool gain_handler::intercept_get(const wax::obj &key, wax::obj &val){
_check_key(key); //verify the key
- // use a vector of tuples to map properties to a reducer function
- // we cant use a map because the wax::obj cant be sorted
- typedef boost::function<gain_t(gain_t, gain_t)> reducer_t;
- typedef boost::tuple<wax::obj, reducer_t> tuple_t;
- reducer_t reducer_sum = boost::bind(std::sum<gain_t>, _1, _2);
- reducer_t reducer_max = boost::bind(std::max<gain_t>, _1, _2);
- std::vector<tuple_t> prop_to_reducer = boost::assign::tuple_list_of
- (_gain_prop, reducer_sum)(_gain_min_prop, reducer_sum)
- (_gain_max_prop, reducer_sum)(_gain_step_prop, reducer_max);
+ std::vector<wax::obj> gain_props = boost::assign::list_of
+ (_gain_prop)(_gain_min_prop)(_gain_max_prop)(_gain_step_prop);
/*!
* Handle getting overall gains when a name is not specified.
* For the gain props below, set the overall value and return true.
*/
- BOOST_FOREACH(tuple_t p2r, prop_to_reducer){
- if (_is_equal(key, p2r.get<0>())){
+ BOOST_FOREACH(wax::obj prop_key, gain_props){
+ if (_is_equal(key, prop_key)){
//form the gains vector from the props vector
prop_names_t prop_names = GET_PROP_NAMES();
std::vector<gain_t> gains(prop_names.size());
std::transform(
prop_names.begin(), prop_names.end(), gains.begin(),
- boost::bind(get_named_gain, _wax_obj_ptr, p2r.get<0>(), _1)
+ boost::bind(get_named_gain, _wax_obj_ptr, key, _1)
);
//reduce across the gain vector
- val = std::reduce<gain_t>(gains.begin(), gains.end(), p2r.get<1>());
+ if (_is_equal(key, _gain_step_prop)){
+ val = std::reduce<gain_t>(gains.begin(), gains.end(), gain_max);
+ }
+ else{
+ val = std::reduce<gain_t>(gains.begin(), gains.end(), gain_sum);
+ }
return true;
}
}
diff --git a/lib/usrp/mboard/test.cpp b/lib/usrp/mboard/test.cpp
index c533c97b4..67d3c70fa 100644
--- a/lib/usrp/mboard/test.cpp
+++ b/lib/usrp/mboard/test.cpp
@@ -91,7 +91,6 @@ private:
}
case DBOARD_PROP_CODEC:
- val = NULL; //TODO
return;
}
}
diff --git a/test/usrp_dboard_test.cpp b/test/usrp_dboard_test.cpp
index a66dfd190..f0ae7a53d 100644
--- a/test/usrp_dboard_test.cpp
+++ b/test/usrp_dboard_test.cpp
@@ -55,6 +55,6 @@ BOOST_AUTO_TEST_CASE(test_manager){
std::cout << "Testing access (will fail later when db code filled in)..." << std::endl;
BOOST_CHECK_THROW(mgr0->get_rx_subdev(""), std::invalid_argument);
BOOST_CHECK_THROW(mgr0->get_tx_subdev("x"), std::invalid_argument);
- mgr0->get_rx_subdev("a")[NULL];
- mgr0->get_tx_subdev("")[NULL];
+ mgr0->get_rx_subdev("a")[0];
+ mgr0->get_tx_subdev("")[0];
}