summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim O'Shea2012-06-13 16:26:52 -0400
committerTim O'Shea2012-06-15 11:20:29 -0400
commite7ea4f2f5f21bc745fd3b3a92b1cee176c00c551 (patch)
tree61142bfa7e56dba3a2651c7a240bca3f8258a52f
parent403103de15cc60e73d38b56cbc16004123eeeda1 (diff)
downloadgnuradio-e7ea4f2f5f21bc745fd3b3a92b1cee176c00c551.tar.gz
gnuradio-e7ea4f2f5f21bc745fd3b3a92b1cee176c00c551.tar.bz2
gnuradio-e7ea4f2f5f21bc745fd3b3a92b1cee176c00c551.zip
New Features:
added support for pmt_serialize and pmt_deserialize for uint64_t type pmts added gr_add_const_bb typed block to gr_add_const_XX gengen
-rw-r--r--gnuradio-core/src/lib/gengen/CMakeLists.txt2
-rw-r--r--gruel/src/lib/pmt/pmt-serial-tags.scm1
-rw-r--r--gruel/src/lib/pmt/pmt_serialize.cc19
3 files changed, 15 insertions, 7 deletions
diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt
index 22ac1bc58..b44a47075 100644
--- a/gnuradio-core/src/lib/gengen/CMakeLists.txt
+++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt
@@ -89,7 +89,7 @@ expand_h_cc_i(gr_sig_source_X s i f c)
expand_h_cc_i(gr_probe_signal_X b s i f c)
expand_h_cc_i(gr_probe_signal_vX b s i f c)
-expand_h_cc_i(gr_add_const_XX ss ii ff cc sf)
+expand_h_cc_i(gr_add_const_XX bb ss ii ff cc sf)
expand_h_cc_i(gr_multiply_const_XX ss ii)
expand_h_cc_i(gr_add_XX ss ii cc)
expand_h_cc_i(gr_sub_XX ss ii ff cc)
diff --git a/gruel/src/lib/pmt/pmt-serial-tags.scm b/gruel/src/lib/pmt/pmt-serial-tags.scm
index ca25a43a8..a78d87681 100644
--- a/gruel/src/lib/pmt/pmt-serial-tags.scm
+++ b/gruel/src/lib/pmt/pmt-serial-tags.scm
@@ -33,6 +33,7 @@
(define pst-dict #x09) ; untagged-int32 n; followed by n key/value tuples
(define pst-uniform-vector #x0a)
+(define pst-uint64 #x0b)
;; u8, s8, u16, s16, u32, s32, u64, s64, f32, f64, c32, c64
;;
diff --git a/gruel/src/lib/pmt/pmt_serialize.cc b/gruel/src/lib/pmt/pmt_serialize.cc
index de9644c3c..05140bb42 100644
--- a/gruel/src/lib/pmt/pmt_serialize.cc
+++ b/gruel/src/lib/pmt/pmt_serialize.cc
@@ -79,7 +79,6 @@ serialize_untagged_f64(double i, std::streambuf &sb)
}
-#if 0
// always writes big-endian
static bool
serialize_untagged_u64(uint64_t i, std::streambuf &sb)
@@ -93,7 +92,6 @@ serialize_untagged_u64(uint64_t i, std::streambuf &sb)
sb.sputc((i >> 8) & 0xff);
return sb.sputc((i >> 0) & 0xff) != std::streambuf::traits_type::eof();
}
-#endif
// ----------------------------------------------------------------
// input primitives
@@ -152,7 +150,6 @@ deserialize_untagged_u32(uint32_t *ip, std::streambuf &sb)
return t != std::streambuf::traits_type::eof();
}
-#if 0
// always reads big-endian
static bool
deserialize_untagged_u64(uint64_t *ip, std::streambuf &sb)
@@ -181,7 +178,6 @@ deserialize_untagged_u64(uint64_t *ip, std::streambuf &sb)
*ip = i;
return t != std::streambuf::traits_type::eof();
}
-#endif
static bool
deserialize_untagged_f64(double *ip, std::streambuf &sb)
@@ -260,7 +256,13 @@ pmt_serialize(pmt_t obj, std::streambuf &sb)
}
if (pmt_is_number(obj)){
-
+
+ if (pmt_is_uint64(obj)){
+ uint64_t i = pmt_to_uint64(obj);
+ ok = serialize_untagged_u8(PST_UINT64, sb);
+ ok &= serialize_untagged_u64(i, sb);
+ return ok;
+ } else
if (pmt_is_integer(obj)){
long i = pmt_to_long(obj);
if (sizeof(long) > 4){
@@ -315,7 +317,7 @@ pmt_deserialize(std::streambuf &sb)
//uint8_t u8;
uint16_t u16;
uint32_t u32;
- //uint32_t u64;
+ uint64_t u64;
double f64;
static char tmpbuf[1024];
@@ -347,6 +349,11 @@ pmt_deserialize(std::streambuf &sb)
goto error;
return pmt_from_long((int32_t) u32);
+ case PST_UINT64:
+ if(!deserialize_untagged_u64(&u64, sb))
+ goto error;
+ return pmt_from_uint64(u64);
+
case PST_PAIR:
return parse_pair(sb);