summaryrefslogtreecommitdiff
path: root/pmt/src/lib/pmt.cc
diff options
context:
space:
mode:
authoreb2007-09-05 01:43:43 +0000
committereb2007-09-05 01:43:43 +0000
commitb644e266dd6f5f4b6cdac126477b61debee89e26 (patch)
treeea2df43c9376b6125ae9b9bba070a3a901fc95f1 /pmt/src/lib/pmt.cc
parent9ccd0ffb7846f7d8d82e9214bca9c2d11311b649 (diff)
downloadgnuradio-b644e266dd6f5f4b6cdac126477b61debee89e26.tar.gz
gnuradio-b644e266dd6f5f4b6cdac126477b61debee89e26.tar.bz2
gnuradio-b644e266dd6f5f4b6cdac126477b61debee89e26.zip
Merged features/inband-usb r5224:6306 into trunk.
This is work-in-progress on inband signaling for the USRP1. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6307 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'pmt/src/lib/pmt.cc')
-rw-r--r--pmt/src/lib/pmt.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/pmt/src/lib/pmt.cc b/pmt/src/lib/pmt.cc
index b896adaa2..b2c04b390 100644
--- a/pmt/src/lib/pmt.cc
+++ b/pmt/src/lib/pmt.cc
@@ -748,7 +748,19 @@ pmt_length(pmt_t x)
if (x->is_uniform_vector())
return _uniform_vector(x)->length();
- // FIXME list length
+ if (x->is_pair() || x->is_null()) {
+ size_t length=0;
+ while (pmt_is_pair(x)){
+ length++;
+ x = pmt_cdr(x);
+ }
+ if (pmt_is_null(x))
+ return length;
+
+ // not a proper list
+ throw pmt_wrong_type("pmt_length", x);
+ }
+
// FIXME dictionary length (number of entries)
throw pmt_wrong_type("pmt_length", x);
@@ -938,6 +950,18 @@ pmt_list4(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4)
}
pmt_t
+pmt_list5(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4, pmt_t x5)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, pmt_cons(x5, PMT_NIL)))));
+}
+
+pmt_t
+pmt_list6(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4, pmt_t x5, pmt_t x6)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, pmt_cons(x5, pmt_cons(x6, PMT_NIL))))));
+}
+
+pmt_t
pmt_caar(pmt_t pair)
{
return (pmt_car(pmt_car(pair)));