summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/io
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib/io')
-rw-r--r--gnuradio-core/src/lib/io/gr_message_burst_source.cc12
-rw-r--r--gnuradio-core/src/lib/io/gr_message_debug.cc12
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu.cc18
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc28
-rw-r--r--gnuradio-core/src/lib/io/gr_socket_pdu.cc18
-rw-r--r--gnuradio-core/src/lib/io/gr_socket_pdu.h12
-rw-r--r--gnuradio-core/src/lib/io/gr_stream_pdu_base.cc10
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.cc20
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc14
9 files changed, 72 insertions, 72 deletions
diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.cc b/gnuradio-core/src/lib/io/gr_message_burst_source.cc
index e9e2dfd4dc..968df6ec38 100644
--- a/gnuradio-core/src/lib/io/gr_message_burst_source.cc
+++ b/gnuradio-core/src/lib/io/gr_message_burst_source.cc
@@ -58,7 +58,7 @@ gr_message_burst_source::gr_message_burst_source (size_t itemsize, int msgq_limi
{
std::stringstream id;
id << name() << unique_id();
- d_me = pmt::pmt_string_to_symbol(id.str());
+ d_me = pmt::string_to_symbol(id.str());
}
gr_message_burst_source::gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq)
@@ -69,7 +69,7 @@ gr_message_burst_source::gr_message_burst_source (size_t itemsize, gr_msg_queue_
{
std::stringstream id;
id << name() << unique_id();
- d_me = pmt::pmt_string_to_symbol(id.str());
+ d_me = pmt::string_to_symbol(id.str());
}
gr_message_burst_source::~gr_message_burst_source()
@@ -107,8 +107,8 @@ gr_message_burst_source::work(int noutput_items,
//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),
+ pmt::string_to_symbol("tx_eob"),
+ pmt::from_bool(1),
d_me //block src id
);
}
@@ -129,8 +129,8 @@ gr_message_burst_source::work(int noutput_items,
//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),
+ pmt::string_to_symbol("tx_sob"),
+ pmt::from_bool(1),
d_me //block src id
);
diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc
index 27f4c65fdc..a0abf4d093 100644
--- a/gnuradio-core/src/lib/io/gr_message_debug.cc
+++ b/gnuradio-core/src/lib/io/gr_message_debug.cc
@@ -47,7 +47,7 @@ void
gr_message_debug::print(pmt::pmt_t msg)
{
std::cout << "******* MESSAGE DEBUG PRINT ********\n";
- pmt::pmt_print(msg);
+ pmt::print(msg);
std::cout << "************************************\n";
}
@@ -61,15 +61,15 @@ gr_message_debug::store(pmt::pmt_t msg)
void
gr_message_debug::print_verbose(pmt::pmt_t msg)
{
- pmt::pmt_t meta = pmt::pmt_car(msg);
- pmt::pmt_t vector = pmt::pmt_cdr(msg);
+ pmt::pmt_t meta = pmt::car(msg);
+ pmt::pmt_t vector = pmt::cdr(msg);
std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n";
- pmt::pmt_print(meta);
- size_t len = pmt::pmt_length(vector);
+ pmt::print(meta);
+ size_t len = 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);
+ const uint8_t* d = (const uint8_t*) uniform_vector_elements(vector, offset);
for(size_t i=0; i<len; i+=16){
printf("%04x: ", i);
for(size_t j=i; j<std::min(i+16,len); j++){
diff --git a/gnuradio-core/src/lib/io/gr_pdu.cc b/gnuradio-core/src/lib/io/gr_pdu.cc
index b2757c307e..c9202647d0 100644
--- a/gnuradio-core/src/lib/io/gr_pdu.cc
+++ b/gnuradio-core/src/lib/io/gr_pdu.cc
@@ -44,11 +44,11 @@ bool
gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v){
switch(type){
case BYTE:
- return pmt::pmt_is_u8vector(v);
+ return pmt::is_u8vector(v);
case FLOAT:
- return pmt::pmt_is_f32vector(v);
+ return pmt::is_f32vector(v);
case COMPLEX:
- return pmt::pmt_is_c32vector(v);
+ return pmt::is_c32vector(v);
default:
throw std::runtime_error("bad type!");
}
@@ -58,22 +58,22 @@ pmt::pmt_t
gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items){
switch(type){
case BYTE:
- return pmt::pmt_init_u8vector(items, buf);
+ return pmt::init_u8vector(items, buf);
case FLOAT:
- return pmt::pmt_init_f32vector(items, (const float*)buf);
+ return pmt::init_f32vector(items, (const float*)buf);
case COMPLEX:
- return pmt::pmt_init_c32vector(items, (const gr_complex*)buf);
+ return 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))
+ if(is_u8vector(vector))
return BYTE;
- if(pmt_is_f32vector(vector))
+ if(is_f32vector(vector))
return FLOAT;
- if(pmt_is_c32vector(vector))
+ if(is_c32vector(vector))
return COMPLEX;
throw std::runtime_error("bad type!");
}
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
index 5c319dc39d..9354a1366d 100644
--- a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc
+++ b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc
@@ -84,46 +84,46 @@ gr_pdu_to_tagged_stream::work(int noutput_items,
}
// make sure type is valid
- if(!pmt::pmt_is_pair(msg)){
+ if(!pmt::is_pair(msg)){
throw std::runtime_error("received a malformed pdu message!");
}
// printf("got a msg\n");
-// pmt::pmt_print(msg);
+// 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?
+ pmt::pmt_t meta(pmt::car(msg)); // make sure this is NIL || Dict ?
+ pmt::pmt_t vect(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()));
+ add_item_tag(0, offset, pdu_length_tag, pmt::from_long( 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));
+ if( !eq(meta, pmt::PMT_NIL) ){
+ pmt::pmt_t pair(pmt::dict_keys( meta ));
+ while( !eq(pair, pmt::PMT_NIL) ){
+ pmt::pmt_t k(pmt::cdr(pair));
+ pmt::pmt_t v(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;
+ size_t ncopy = std::min((size_t)noutput_items, (size_t)pmt::length(vect));
+ size_t nsave = pmt::length(vect) - ncopy;
// copy output
size_t io(0);
nout += ncopy;
- memcpy(out, pmt_uniform_vector_elements(vect,io), ncopy*d_itemsize);
+ memcpy(out, 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);
+ memcpy(&d_remain[0], uniform_vector_elements(vect,ncopy), nsave*d_itemsize);
}
}
diff --git a/gnuradio-core/src/lib/io/gr_socket_pdu.cc b/gnuradio-core/src/lib/io/gr_socket_pdu.cc
index bb374b3006..366ca507bc 100644
--- a/gnuradio-core/src/lib/io/gr_socket_pdu.cc
+++ b/gnuradio-core/src/lib/io/gr_socket_pdu.cc
@@ -114,8 +114,8 @@ void tcp_connection::handle_read(const boost::system::error_code& error/*error*/
{
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);
+ pmt::pmt_t vector = pmt::init_u8vector(bytes_transferred, (const uint8_t*)&buf[0]);
+ pmt::pmt_t pdu = pmt::cons( pmt::PMT_NIL, vector);
d_block->message_port_pub( pmt::mp("pdus"), pdu );
@@ -131,27 +131,27 @@ void tcp_connection::handle_read(const boost::system::error_code& error/*error*/
void gr_socket_pdu::tcp_server_send(pmt::pmt_t msg){
- pmt::pmt_t vector = pmt::pmt_cdr(msg);
+ pmt::pmt_t vector = 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);
+ pmt::pmt_t vector = pmt::cdr(msg);
+ size_t len = pmt::length(vector);
size_t offset(0);
boost::array<char, 10000> txbuf;
- memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len);
+ memcpy(&txbuf[0], 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);
+ pmt::pmt_t vector = pmt::cdr(msg);
+ size_t len = pmt::length(vector);
size_t offset(0);
boost::array<char, 10000> txbuf;
- memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len);
+ memcpy(&txbuf[0], 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
index f554febdc1..4e58006028 100644
--- a/gnuradio-core/src/lib/io/gr_socket_pdu.h
+++ b/gnuradio-core/src/lib/io/gr_socket_pdu.h
@@ -67,10 +67,10 @@ public:
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 len = pmt::length(vector);
size_t offset(0);
boost::array<char, 10000> txbuf;
- memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len);
+ memcpy(&txbuf[0], 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,
@@ -160,8 +160,8 @@ class GR_CORE_API gr_socket_pdu : public gr_stream_pdu_base
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);
+ pmt::pmt_t vector = pmt::init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]);
+ pmt::pmt_t pdu = pmt::cons( pmt::PMT_NIL, vector);
message_port_pub( pmt::mp("pdus"), pdu );
@@ -177,8 +177,8 @@ class GR_CORE_API gr_socket_pdu : public gr_stream_pdu_base
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);
+ pmt::pmt_t vector = pmt::init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]);
+ pmt::pmt_t pdu = pmt::cons( pmt::PMT_NIL, vector);
message_port_pub( pmt::mp("pdus"), pdu );
diff --git a/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc b/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc
index cff7296cba..108424d393 100644
--- a/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc
+++ b/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc
@@ -73,19 +73,19 @@ void gr_stream_pdu_base::run(){
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);
+ pmt::pmt_t vector = pmt::init_u8vector(result, &d_rxbuf[0]);
+ pmt::pmt_t pdu = 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);
+ pmt::pmt_t vector = pmt::cdr(msg);
size_t offset(0);
size_t itemsize(gr_pdu_itemsize(type_from_pmt(vector)));
- int len( pmt::pmt_length(vector)*itemsize );
+ int len( pmt::length(vector)*itemsize );
- const int rv = write(d_fd, pmt::pmt_uniform_vector_elements(vector, offset), len);
+ const int rv = write(d_fd, 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;
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
index c9c8407a07..3288fcdd60 100644
--- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
@@ -81,8 +81,8 @@ gr_tagged_file_sink::work (int noutput_items,
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("rx_time"); // use gr_tags::key_time
+ pmt::pmt_t bkey = pmt::string_to_symbol("burst");
+ pmt::pmt_t tkey = pmt::string_to_symbol("rx_time"); // use gr_tags::key_time
std::vector<gr_tag_t> all_tags;
get_tags_in_range(all_tags, 0, start_N, end_N);
@@ -98,8 +98,8 @@ gr_tagged_file_sink::work (int noutput_items,
const gr_tag_t tag = time_tags_outer[0];
uint64_t offset = tag.offset;
pmt::pmt_t time = tag.value;
- uint64_t tsecs = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(time, 0));
- double tfrac = pmt::pmt_to_double(pmt::pmt_tuple_ref(time, 1));
+ uint64_t tsecs = pmt::to_uint64(pmt::tuple_ref(time, 0));
+ double tfrac = pmt::to_double(pmt::tuple_ref(time, 1));
double delta = (double)offset / d_sample_rate;
d_timeval = (double)tsecs + tfrac + delta;
d_last_N = offset;
@@ -109,8 +109,8 @@ gr_tagged_file_sink::work (int noutput_items,
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)) {
+ if((pmt::eqv((*vitr).key, bkey)) &&
+ pmt::is_true((*vitr).value)) {
uint64_t N = (*vitr).offset;
idx = (int)(N - start_N);
@@ -130,8 +130,8 @@ gr_tagged_file_sink::work (int noutput_items,
// Get time based on last time tag from USRP
pmt::pmt_t time = tag.value;
- uint64_t tsecs = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(time, 0));
- double tfrac = pmt::pmt_to_double(pmt::pmt_tuple_ref(time, 1));
+ uint64_t tsecs = pmt::to_uint64(pmt::tuple_ref(time, 0));
+ double tfrac = pmt::to_double(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
@@ -187,8 +187,8 @@ gr_tagged_file_sink::work (int noutput_items,
}
else { // In burst
while(vitr != all_tags.end()) {
- if((pmt::pmt_eqv((*vitr).key, bkey)) &&
- pmt::pmt_is_false((*vitr).value)) {
+ if((pmt::eqv((*vitr).key, bkey)) &&
+ pmt::is_false((*vitr).value)) {
uint64_t N = (*vitr).offset;
idx_stop = (int)N - start_N;
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
index 8211b7672d..3493f6a389 100644
--- a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc
+++ b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc
@@ -70,14 +70,14 @@ gr_tagged_stream_to_pdu::work(int noutput_items,
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( 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_length = pmt::to_long( (*d_tags_itr).value );
d_pdu_remain = d_pdu_length;
- d_pdu_meta = pmt::pmt_make_dict();
+ d_pdu_meta = pmt::make_dict();
break;
} // if have length tag
} // iter over tags
@@ -91,8 +91,8 @@ gr_tagged_stream_to_pdu::work(int noutput_items,
// 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);
+ if( ! equal( (*d_tags_itr).key, pdu_length_tag ) ){
+ d_pdu_meta = dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value);
}
}
@@ -122,11 +122,11 @@ gr_tagged_stream_to_pdu::work(int noutput_items,
void gr_tagged_stream_to_pdu::send_message(){
- if(pmt::pmt_length(d_pdu_vector) != d_pdu_length){
+ if(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 );
+ pmt::pmt_t msg = pmt::cons( d_pdu_meta, d_pdu_vector );
message_port_pub( pdu_port_id, msg );
d_pdu_meta = pmt::PMT_NIL;