diff options
Diffstat (limited to 'host/lib/rfnoc/nocscript')
-rw-r--r-- | host/lib/rfnoc/nocscript/block_iface.cpp | 26 | ||||
-rw-r--r-- | host/lib/rfnoc/nocscript/expression.cpp | 7 | ||||
-rw-r--r-- | host/lib/rfnoc/nocscript/function_table.cpp | 1 |
3 files changed, 16 insertions, 18 deletions
diff --git a/host/lib/rfnoc/nocscript/block_iface.cpp b/host/lib/rfnoc/nocscript/block_iface.cpp index 0d301e5bc..544593def 100644 --- a/host/lib/rfnoc/nocscript/block_iface.cpp +++ b/host/lib/rfnoc/nocscript/block_iface.cpp @@ -18,12 +18,12 @@ #include "block_iface.hpp" #include "function_table.hpp" #include <uhd/exception.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <boost/assign.hpp> #include <boost/bind.hpp> #include <boost/format.hpp> -#define UHD_NOCSCRIPT_LOG() UHD_LOGV(never) +#define UHD_NOCSCRIPT_LOG() UHD_LOGGER_TRACE("RFNOC") using namespace uhd::rfnoc; using namespace uhd::rfnoc::nocscript; @@ -116,7 +116,7 @@ void block_iface::run_and_check(const std::string &code, const std::string &erro { boost::mutex::scoped_lock local_interpreter_lock(_lil_mutex); - UHD_NOCSCRIPT_LOG() << "[NocScript] Executing and asserting code: " << code << std::endl; + UHD_NOCSCRIPT_LOG() << "[NocScript] Executing and asserting code: " << code ; expression::sptr e = _parser->create_expr_tree(code); expression_literal result = e->eval(); if (not result.to_bool()) { @@ -143,12 +143,12 @@ expression_literal block_iface::_nocscript__sr_write(expression_container::expr_ const uint32_t reg_val = uint32_t(args[1]->eval().get_int()); bool result = true; try { - UHD_NOCSCRIPT_LOG() << "[NocScript] Executing SR_WRITE() " << std::endl; + UHD_NOCSCRIPT_LOG() << "[NocScript] Executing SR_WRITE() " ; _block_ptr->sr_write(reg_name, reg_val); } catch (const uhd::exception &e) { - UHD_MSG(error) << boost::format("[NocScript] Error while executing SR_WRITE(%s, 0x%X):\n%s") + UHD_LOGGER_ERROR("RFNOC") << boost::format("[NocScript] Error while executing SR_WRITE(%s, 0x%X):\n%s") % reg_name % reg_val % e.what() - << std::endl; + ; result = false; } @@ -195,7 +195,7 @@ expression_literal block_iface::_nocscript__arg_set_int(const expression_contain if (args.size() == 3) { port = size_t(args[2]->eval().get_int()); } - UHD_NOCSCRIPT_LOG() << "[NocScript] Setting $" << var_name << std::endl; + UHD_NOCSCRIPT_LOG() << "[NocScript] Setting $" << var_name ; _block_ptr->set_arg<int>(var_name, val, port); return expression_literal(true); } @@ -208,7 +208,7 @@ expression_literal block_iface::_nocscript__arg_set_string(const expression_cont if (args.size() == 3) { port = size_t(args[2]->eval().get_int()); } - UHD_NOCSCRIPT_LOG() << "[NocScript] Setting $" << var_name << std::endl; + UHD_NOCSCRIPT_LOG() << "[NocScript] Setting $" << var_name ; _block_ptr->set_arg<std::string>(var_name, val, port); return expression_literal(true); } @@ -221,7 +221,7 @@ expression_literal block_iface::_nocscript__arg_set_double(const expression_cont if (args.size() == 3) { port = size_t(args[2]->eval().get_int()); } - UHD_NOCSCRIPT_LOG() << "[NocScript] Setting $" << var_name << std::endl; + UHD_NOCSCRIPT_LOG() << "[NocScript] Setting $" << var_name ; _block_ptr->set_arg<double>(var_name, val, port); return expression_literal(true); } @@ -239,8 +239,8 @@ block_iface::sptr block_iface::make(uhd::rfnoc::block_ctrl_base* block_ptr) expression_literal block_iface::_nocscript__var_get(const expression_container::expr_list_type &args) { expression_literal expr = _vars[args[0]->eval().get_string()]; - //std::cout << "[NocScript] Getting var " << args[0]->eval().get_string() << " == " << expr << std::endl; - //std::cout << "[NocScript] Type " << expr.infer_type() << std::endl; + //std::cout << "[NocScript] Getting var " << args[0]->eval().get_string() << " == " << expr ; + //std::cout << "[NocScript] Type " << expr.infer_type() ; //return _vars[args[0]->eval().get_string()]; return expr; } @@ -248,8 +248,8 @@ expression_literal block_iface::_nocscript__var_get(const expression_container:: expression_literal block_iface::_nocscript__var_set(const expression_container::expr_list_type &args) { _vars[args[0]->eval().get_string()] = args[1]->eval(); - //std::cout << "[NocScript] Set var " << args[0]->eval().get_string() << " to " << _vars[args[0]->eval().get_string()] << std::endl; - //std::cout << "[NocScript] Type " << _vars[args[0]->eval().get_string()].infer_type() << std::endl; + //std::cout << "[NocScript] Set var " << args[0]->eval().get_string() << " to " << _vars[args[0]->eval().get_string()] ; + //std::cout << "[NocScript] Type " << _vars[args[0]->eval().get_string()].infer_type() ; return expression_literal(true); } diff --git a/host/lib/rfnoc/nocscript/expression.cpp b/host/lib/rfnoc/nocscript/expression.cpp index 38d6e2128..257e0b447 100644 --- a/host/lib/rfnoc/nocscript/expression.cpp +++ b/host/lib/rfnoc/nocscript/expression.cpp @@ -18,7 +18,6 @@ #include "expression.hpp" #include "function_table.hpp" #include <uhd/utils/cast.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/assign.hpp> #include <boost/algorithm/string.hpp> @@ -77,7 +76,7 @@ expression_literal::expression_literal( std::string str_vec = _val.substr(1, _val.size()-2); std::vector<std::string> subtoken_list; boost::split(subtoken_list, str_vec, boost::is_any_of(", "), boost::token_compress_on); - BOOST_FOREACH(const std::string &t, subtoken_list) { + for(const std::string &t: subtoken_list) { _int_vector_val.push_back(boost::lexical_cast<int>(t)); } break; @@ -299,7 +298,7 @@ expression_literal expression_container::eval() } expression_literal ret_val; - BOOST_FOREACH(const expression::sptr &sub_expr, _sub_exprs) { + for(const expression::sptr &sub_expr: _sub_exprs) { ret_val = sub_expr->eval(); if (_combiner == COMBINE_AND and ret_val.to_bool() == false) { return ret_val; @@ -319,7 +318,7 @@ std::string expression_function::to_string(const std::string &name, const argtyp { std::string s = name; int arg_count = 0; - BOOST_FOREACH(const expression::type_t type, types) { + for(const expression::type_t type: types) { if (arg_count == 0) { s += "("; } else { diff --git a/host/lib/rfnoc/nocscript/function_table.cpp b/host/lib/rfnoc/nocscript/function_table.cpp index a4e36c1a1..aabaef635 100644 --- a/host/lib/rfnoc/nocscript/function_table.cpp +++ b/host/lib/rfnoc/nocscript/function_table.cpp @@ -18,7 +18,6 @@ #include "function_table.hpp" #include "basic_functions.hpp" #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <map> |