[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6731 - gnuradio/branches/developers/gnychis/inband/pm
From: |
gnychis |
Subject: |
[Commit-gnuradio] r6731 - gnuradio/branches/developers/gnychis/inband/pmt/src/lib |
Date: |
Sun, 28 Oct 2007 22:56:17 -0600 (MDT) |
Author: gnychis
Date: 2007-10-28 22:56:17 -0600 (Sun, 28 Oct 2007)
New Revision: 6731
Modified:
gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc
gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h
gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.cc
gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.h
Log:
Adding in a new PMT primitive for adding an item to a list which strays away
from the need for many static pmt_list*() methods and allows for a better
dynamic creation of PMT lists.
It needs to be optimized.
Modified: gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc
===================================================================
--- gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc
2007-10-29 01:20:31 UTC (rev 6730)
+++ gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.cc
2007-10-29 04:56:17 UTC (rev 6731)
@@ -962,6 +962,12 @@
}
pmt_t
+pmt_list_add(pmt_t list, pmt_t item)
+{
+ return pmt_reverse(pmt_cons(item, pmt_reverse(list)));
+}
+
+pmt_t
pmt_caar(pmt_t pair)
{
return (pmt_car(pmt_car(pair)));
Modified: gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h
===================================================================
--- gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h
2007-10-29 01:20:31 UTC (rev 6730)
+++ gnuradio/branches/developers/gnychis/inband/pmt/src/lib/pmt.h
2007-10-29 04:56:17 UTC (rev 6731)
@@ -609,7 +609,12 @@
*/
pmt_t pmt_list6(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4, pmt_t x5, pmt_t x6);
+/*!
+ * \brief Return \p list with \p item added to it.
+ */
+pmt_t pmt_list_add(pmt_t list, pmt_t item);
+
/*
* ------------------------------------------------------------------------
* read / write
Modified:
gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.cc
===================================================================
--- gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.cc
2007-10-29 01:20:31 UTC (rev 6730)
+++ gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.cc
2007-10-29 04:56:17 UTC (rev 6731)
@@ -301,6 +301,20 @@
CPPUNIT_ASSERT_EQUAL(std::string("k0"), pmt_write_string(k0));
}
+void
+qa_pmt_prims::test_lists()
+{
+ pmt_t s0 = pmt_intern("s0");
+ pmt_t s1 = pmt_intern("s1");
+ pmt_t s2 = pmt_intern("s2");
+ pmt_t s3 = pmt_intern("s3");
+
+ pmt_t l1 = pmt_list4(s0, s1, s2, s3);
+ pmt_t l2 = pmt_list3(s0, s1, s2);
+ pmt_t l3 = pmt_list_add(l2, s3);
+ CPPUNIT_ASSERT(pmt_equal(l1, l3));
+}
+
// ------------------------------------------------------------------------
// class foo is used in test_any below.
Modified: gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.h
===================================================================
--- gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.h
2007-10-29 01:20:31 UTC (rev 6730)
+++ gnuradio/branches/developers/gnychis/inband/pmt/src/lib/qa_pmt_prims.h
2007-10-29 04:56:17 UTC (rev 6731)
@@ -40,6 +40,7 @@
CPPUNIT_TEST(test_dict);
CPPUNIT_TEST(test_any);
CPPUNIT_TEST(test_io);
+ CPPUNIT_TEST(test_lists);
CPPUNIT_TEST(test_serialize);
CPPUNIT_TEST_SUITE_END();
@@ -56,6 +57,7 @@
void test_dict();
void test_any();
void test_io();
+ void test_lists();
void test_serialize();
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6731 - gnuradio/branches/developers/gnychis/inband/pmt/src/lib,
gnychis <=