summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-09-19 11:36:10 -0600
committerTuowen Zhao <ztuowen@gmail.com>2016-09-19 11:36:10 -0600
commit62f7acd88465f4f20b9b25c3f7edd4e3b7ce453b (patch)
tree224cc286126ae2bb9674973f0ccaee07e324433f
parent7115fd7bf9d36cc003e818825dd75fa8bf3eb69e (diff)
downloadchill-62f7acd88465f4f20b9b25c3f7edd4e3b7ce453b.tar.gz
chill-62f7acd88465f4f20b9b25c3f7edd4e3b7ce453b.tar.bz2
chill-62f7acd88465f4f20b9b25c3f7edd4e3b7ce453b.zip
rm template.c
-rw-r--r--omegalib/omega/include/basic/Bag.c329
-rw-r--r--omegalib/omega/include/basic/DynamicArray.c219
-rw-r--r--omegalib/omega/include/basic/List.c149
-rw-r--r--omegalib/omega/include/basic/Map.c63
-rw-r--r--omegalib/omega/include/basic/Section.c79
-rw-r--r--omegalib/omega/include/basic/SimpleList.c105
-rw-r--r--omegalib/omega/include/basic/Tuple.c254
-rwxr-xr-xomegalib/omega/include/basic/boolset-test.cc72
8 files changed, 0 insertions, 1270 deletions
diff --git a/omegalib/omega/include/basic/Bag.c b/omegalib/omega/include/basic/Bag.c
deleted file mode 100644
index c3084c1..0000000
--- a/omegalib/omega/include/basic/Bag.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/****************************************************************
- * *
- * Collection constructors, desctructors, assignments *
- * *
- ****************************************************************/
-
-#include <assert.h>
-
-namespace omega {
-
-template<class T> Bag<T>::Bag() {
- contents = new List_Element <T>;
- contents->tail = 0;
- }
-template<class T> Bag<T>::~Bag() {
- delete contents;
- }
-
-template<class T> Ordered_Bag<T>::Ordered_Bag() {}
-
-template<class T> Set<T>::Set() {}
-
-template<class T> Bag<T>::Bag(const Bag<T> &L) {
- contents = new List_Element<T>(*L.contents);
- }
-
-template<class T> Bag<T> & Bag<T>::operator=(const Bag<T> &L) {
- if (this != &L) {
- delete contents;
- contents = new List_Element<T>(*L.contents);
- }
- return *this;
- }
-
-
-
-template<class T> Set<T>::Set(T e) {
- assert(this->contents);
- this->contents->tail = new List_Element<T>(e, 0);
- }
-
-
-/****************************************************************
- * *
- * Misc. simple Collection operations *
- * *
- ****************************************************************/
-
-template<class T> bool Bag<T>::empty() const {
- return contents->tail == 0;
- }
-
-template<class T> Iterator<T> *Bag<T>::new_iterator()
- {
- return new List_Element_Iterator<T>(contents->tail);
- }
-
-
-template<class T> void Bag<T>::clear() {
- if (contents->tail) delete contents->tail;
- contents->tail = 0;
- }
-
-template<class T> int Bag<T>::size() const {
- int i = 0;
- List_Element<T> * p = contents->tail;
- while (p) {
- p = p->tail;
- i++;
- };
- return i;
- }
-
-
-/****************************************************************
- * *
- * Collection/Element operations (e.g. insert, contains) *
- * *
- ****************************************************************/
-
-template<class T> void Bag<T>::remove(T e) {
- List_Element<T> * p = contents;
- while (p->tail && p->tail->head != e) p = p->tail;
- if (p->tail && p->tail->head == e) {
- List_Element<T> * q = p->tail;
- p->tail = q->tail;
- q->tail = 0;
- delete q;
- }
- }
-
-template<class T> T Bag<T>::extract() {
- List_Element<T> * p = contents->tail;
- T e = p->head;
- contents->tail = p->tail;
- p->tail = 0;
- delete p;
- return e;
- }
-
-
-template<class T> void Bag<T>::insert(T e) {
- List_Element<T> * q = new List_Element<T>(e,contents->tail);
- contents->tail = q;
- }
-
-template<class T> void Ordered_Bag<T>::insert(T e) {
- List_Element<T> * p = this->contents;
- while (p->tail && p->tail->head < e) p = p->tail;
- if (!p->tail || p->tail->head != e) {
- List_Element<T> * q = new List_Element<T>(e,p->tail);
- p->tail = q;
- }
- }
-
-
-template<class T> bool Bag<T>::contains(T e) const {
- List_Element<T> * p = contents;
- while (p->tail && p->tail->head != e) p = p->tail;
- return (p->tail && p->tail->head == e);
- }
-
-template<class T> bool Ordered_Bag<T>::contains(T e) const {
- List_Element<T> * p = this->contents;
- while (p->tail && p->tail->head < e) p = p->tail;
- return (p->tail && p->tail->head == e);
- }
-
-
-template<class T> bool Set<T>::contains (const Set<T>& b) const {
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents;
- do {
- /* consume matched elements in p and q */
- p = p->tail;
- q = q->tail;
- if (!q) return 1; /* no more elements to match */
- if (!p) return 0; /* nothing left in p to match with */
- if (q->head < p->head) {
- /* nothing smaller than
- p->head left in p, so q->head
- can't be matched */
- return 0;
- };
- while (p && p->head < q->head) {
- /* toss away some elements from p */
- p = p->tail;
- }
- if (!p || q->head < p->head) return 0;
- } while (q);
-
- return 1;
- }
-
-
-
-/****************************************************************
- * *
- * Collection/Collection operations (e.g. |=) *
- * *
- ****************************************************************/
-
-template<class T> void Bag<T>::operator |= (const Bag<T> & b) {
- assert(this != &b);
- List_Element<T> * q = b.contents->tail;
-
- while (q) {
- List_Element<T> * r = new List_Element<T>(q->head,contents->tail);
- contents->tail = r;
- q = q->tail;
- }
- }
-
-template<class T> void Ordered_Bag<T>::operator |= (const Ordered_Bag<T> & b) {
- if (this == &b) return;
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents->tail;
-
- while (q) {
- while (p->tail && p->tail->head < q->head) p = p->tail;
- List_Element<T> * r = new List_Element<T>(q->head,p->tail);
- p->tail = r;
- q = q->tail;
- }
- }
-
-template<class T> void Ordered_Bag<T>::operator |= (const Bag<T> & b) {
- Ordered_Bag<T> tmp;
- for (List_Element<T> *p = b.contents; p; p=p->tail) {
- tmp.insert(p->head);
- }
- *this |= tmp;
-}
-
-template<class T> void Set<T>::operator |= (const Set<T> & b) {
- if (this == &b) return;
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents->tail;
-
- while (q) {
- while (p->tail && p->tail->head < q->head) p = p->tail;
- if (!p->tail || p->tail->head != q->head) {
- List_Element<T> * r = new List_Element<T>(q->head,p->tail);
- p->tail = r;
- }
- q = q->tail;
- }
- }
-
-template<class T> void Set<T>::operator |= (const Ordered_Bag<T> & b) {
- Set<T> tmp;
- for (List_Element<T> *p = b.contents; p; p=p->tail) {
- tmp.insert(p->head);
- }
- *this |= tmp;
-}
-
-template<class T> void Set<T>::operator |= (const Bag<T> & b) {
- Set<T> tmp;
- for (List_Element<T> *p = b.contents; p; p=p->tail) {
- tmp.insert(p->head);
- }
- *this |= tmp;
-}
-
-
-
-// delete items also in b
-template<class T> void Set<T>::operator -= (const Set<T> & b) {
- if (this == &b) {
- this->clear();
- return;
- }
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents->tail;
-
- while (q) {
- while (p->tail && p->tail->head < q->head) p = p->tail;
- if (p->tail && p->tail->head == q->head) {
- List_Element<T> * r = p->tail;
- p->tail = r->tail;
- r->tail = 0;
- delete r;
- }
- q = q->tail;
- }
- }
-
-
-// delete items not in b
-template<class T> void Set<T>::operator &= (const Set<T> & b)
- {
- if (this == &b) return;
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents->tail;
-
- while (q) {
- while (p->tail && p->tail->head < q->head) {
- List_Element<T> * r = p->tail;
- p->tail = r->tail;
- r->tail = 0;
- delete r;
- };
- if (p->tail && p->tail->head == q->head) {
- /* allow p->tail->head into the result */
- p = p->tail;
- }
- /* q->head has matched anything it is going to match */
- q = q->tail;
- }
- if (p->tail) {
- delete p->tail;
- p->tail = 0;
- };
-
- }
-
-
-template<class T> bool Set<T>::operator & (const Set<T>& b) const {
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents;
- do {
- p = p->tail;
- q = q->tail;
- while (p && q && p->head != q->head) {
- while (p && p->head < q->head) p = p->tail;
- while (p && q && q->head < p->head) q = q->tail;
- };
- if (p && q && p->head == q->head) return 1;
- } while (p && q);
-
- return 0;
- }
-
-
-template<class T> bool Ordered_Bag<T>::operator == (const Ordered_Bag<T>& b) const {
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents;
- while (1) {
- p = p->tail;
- q = q->tail;
- if (!p && !q) return 1;
- if (!p || !q) return 0;
- if (p->head != q->head) return 0;
- };
-
- }
-
-template<class T> bool Ordered_Bag<T>::operator != (const Ordered_Bag<T>& b) const {
- return !(*this == b);
- }
-
-template<class T> bool Ordered_Bag<T>::operator < (const Ordered_Bag<T>& b) const {
- List_Element<T> * p = this->contents;
- List_Element<T> * q = b.contents;
- while (1) {
- p = p->tail;
- q = q->tail;
- if (!p && !q) return 0;
- if (!p) return 1;
- if (!q) return 0;
- if (p->head < q->head) return 1;
- if (q->head < p->head) return 0;
- };
-
- return 1;
- }
-
-} // namespace
diff --git a/omegalib/omega/include/basic/DynamicArray.c b/omegalib/omega/include/basic/DynamicArray.c
deleted file mode 100644
index 8ede2f7..0000000
--- a/omegalib/omega/include/basic/DynamicArray.c
+++ /dev/null
@@ -1,219 +0,0 @@
-#include <assert.h>
-#include <basic/DynamicArray.h>
-
-namespace omega {
-
-template<class T, int d> void DynamicArray<T,d>::do_constr()
- {
-// #if ! defined SHUT_UP_ABOUT_STATEMENT_WITH_NO_EFFECT_IN_DYNAMIC_ARRAY_CREATION
-// assert(d > 0);
-// #endif
- bounds = 0;
- elements = 0;
- partial = false;
- }
-
-
-template<class T> void DynamicArray1<T>::do_construct(int d0)
- {
- this->bounds = new int[1];
- this->bounds[0] = d0;
- this->elements = new T [d0];
- this->partial = false;
- }
-
-template<class T> void DynamicArray2<T>::do_construct(int d0, int d1)
- {
- this->bounds = new int[2];
- this->bounds[0] = d0;
- this->bounds[1] = d1;
- this->elements = new T [d0 * d1];
- this->partial = false;
- }
-
-template<class T> void DynamicArray3<T>::do_construct(int d0,int d1,int d2)
- {
- this->bounds = new int[3];
- this->bounds[0] = d0;
- this->bounds[1] = d1;
- this->bounds[2] = d2;
- this->elements = new T [d0 * d1 * d2];
- this->partial = false;
- }
-
-template<class T> void DynamicArray4<T>::do_construct(int d0,int d1,int d2,int d3)
- {
- this->bounds = new int[4];
- this->bounds[0] = d0;
- this->bounds[1] = d1;
- this->bounds[2] = d2;
- this->bounds[3] = d3;
- this->elements = new T [d0 * d1 * d2 * d3];
- this->partial = false;
- }
-
-template<class T, int d> DynamicArray<T,d>::DynamicArray()
- {
- do_constr();
- }
-
-template<class T> DynamicArray1<T>::DynamicArray1(const char *)
- {
- this->do_constr();
- }
-
-template<class T> DynamicArray2<T>::DynamicArray2(const char *,const char *)
- {
- this->do_constr();
- }
-
-template<class T> DynamicArray3<T>::DynamicArray3(const char *,const char *,const char *)
- {
- this->do_constr();
- }
-
-template<class T> DynamicArray4<T>::DynamicArray4(const char *,const char *,const char *,const char *)
- {
- this->do_constr();
- }
-
-template<class T> DynamicArray1<T>::DynamicArray1(int d0)
- {
- do_construct(d0);
- }
-
-template<class T> DynamicArray2<T>::DynamicArray2(int d0, int d1)
- {
- do_construct(d0, d1);
- }
-
-template<class T> DynamicArray3<T>::DynamicArray3(int d0,int d1,int d2)
- {
- do_construct(d0, d1, d2);
- }
-
-template<class T> DynamicArray4<T>::DynamicArray4(int d0,int d1,int d2,int d3)
- {
- do_construct(d0, d1, d2, d3);
- }
-
-
-template<class T, int d> void DynamicArray<T,d>::do_destruct()
- {
- if (! partial)
- {
- delete [] bounds;
- delete [] elements;
- }
- }
-
-
-template<class T, int d> DynamicArray<T,d>::~DynamicArray()
- {
- do_destruct();
- }
-
-
-template<class T> void DynamicArray1<T>::resize(int d0)
- {
- assert(!this->partial);
- this->do_destruct();
- if (d0 == 0)
- this->do_constr();
- else
- do_construct(d0);
- }
-
-template<class T> void DynamicArray2<T>::resize(int d0, int d1)
- {
- assert(!this->partial);
- this->do_destruct();
- if (d0 == 0 && d1 == 0)
- this->do_constr();
- else
- do_construct(d0, d1);
- }
-
-template<class T> void DynamicArray3<T>::resize(int d0, int d1, int d2)
- {
- assert(!this->partial);
- this->do_destruct();
- if (d0 == 0 && d1 == 0 && d2 == 0)
- this->do_constr();
- else
- do_construct(d0, d1, d2);
- }
-
-template<class T> void DynamicArray4<T>::resize(int d0, int d1, int d2, int d3)
- {
- assert(!this->partial);
- this->do_destruct();
- if (d0 == 0 && d1 == 0 && d2 == 0 && d3 == 0)
- this->do_constr();
- else
- do_construct(d0, d1, d2, d3);
- }
-
-
-template<class T> T& DynamicArray1<T>::operator[](int d0)
- {
-#if !defined (NDEBUG)
- assert(this->elements != 0 && "Trying to dereference undefined array");
- assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds");
-#endif
-
- return this->elements[d0];
- }
-
-template<class T> DynamicArray1<T> DynamicArray2<T>::operator[](int d0)
- {
-#if !defined (NDEBUG)
- assert(this->elements != 0 && "Trying to dereference undefined array");
- assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds");
-#endif
-
- DynamicArray1<T> result;
- result.bounds = this->bounds+1;
- result.elements = this->elements + this->bounds[1] * d0;
- result.partial = true;
- return result;
- }
-
-template<class T> DynamicArray2<T> DynamicArray3<T>::operator[](int d0)
- {
-#if !defined (NDEBUG)
- assert(this->elements != 0 && "Trying to dereference undefined array");
- assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds");
-#endif
- DynamicArray2<T> result;
- result.bounds = this->bounds+1;
- result.elements = this->elements + this->bounds[1] * this->bounds[2] * d0;
- result.partial = true;
- return result;
- }
-
-template<class T> DynamicArray3<T> DynamicArray4<T>::operator[](int d0)
- {
-#if !defined (NDEBUG)
- assert(this->elements != 0 && "Trying to dereference undefined array");
- assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds");
-#endif
-
- DynamicArray3<T> result;
- result.bounds = this->bounds+1;
- result.elements = this->elements + this->bounds[1] * this->bounds[2] * this->bounds[3] * d0;
- result.partial = true;
- return result;
- }
-
-
-template<class T, int d>
- DynamicArray<T,d>::DynamicArray(DynamicArray<T,d> &D)
- {
- assert(D.elements != 0 && "Trying to copy an undefined array");
- partial = true;
- bounds = D.bounds;
- elements = D.elements;
- }
-
-} // namespace
diff --git a/omegalib/omega/include/basic/List.c b/omegalib/omega/include/basic/List.c
deleted file mode 100644
index f05e0de..0000000
--- a/omegalib/omega/include/basic/List.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include <assert.h>
-
-namespace omega {
-
-template<class T> List_Iterator<T>::List_Iterator(List<T> &l)
-: List_Element_Iterator<T>(l.contents) {}
-
-template<class T> List_Iterator<T>::List_Iterator(const List<T> &l)
-: List_Element_Iterator<T>(l.contents) {}
-
-template<class T> List_Iterator<T>::List_Iterator()
-: List_Element_Iterator<T>(0) {}
-
-template<class T> Iterator<T> *List<T>::new_iterator()
-{
- return new List_Iterator<T>(*this);
-}
-
-template<class T> const T &List<T>::operator[](int i) const
-{
- assert(i > 0 && "Subscript out of bounds");
- List_Iterator<T> p(*this);
-
- while(--i > 0 && p)
- p++;
-
- if (p)
- return *p;
- else
- return *((T *)0);
-}
-
-template<class T> T &List<T>::operator[](int i)
-{
- assert(i > 0 && "Subscript out of bounds");
- List_Iterator<T> p(*this);
-
- while(--i > 0 && p)
- p++;
-
- if (p)
- return *p;
- else
- return *((T *)0);
-}
-
-template<class T> int List<T>::index(const T &item) const
-{
- List_Iterator<T> p(*this);
- int i = 1;
-
- while(p && *p != item)
- {
- p++;
- i++;
- }
-
- if (p)
- return i;
- else
- return 0;
-}
-
-template<class T> int List<T>::size() const
- {
- int i = 0;
- List_Element<T> * p = contents;
- while (p)
- {
- p = p->tail;
- i++;
- }
- return i;
- }
-
-template<class T> T &List<T>::front() const
- {
- return contents->head;
- }
-
-template<class T> T List<T>::remove_front()
- {
- List_Element<T> *frunt = contents;
- contents = contents->tail;
- T fruntT = frunt->head;
- frunt->tail = 0;
- delete frunt;
- return fruntT;
- }
-
-template<class T> void List<T>::prepend(const T &item)
- {
- contents = new List_Element<T>(item, contents);
- }
-
-
-template<class T> void List<T>::append(const T &item)
- {
- *(end()) = new List_Element<T>(item, 0);
- }
-
-template<class T> void List<T>::ins_after(List_Iterator<T> i,
- const T &item)
- {
-#if ! defined NDEBUG
- for (List_Element<T> *e = contents; e != &(i.element()); e=e->tail)
- {
- assert(e);
- }
-#endif
- i.element().tail = new List_Element<T>(item, i.element().tail);
- }
-
-template<class T> void List<T>::del_front()
- {
- List_Element<T> *e = contents;
- contents = contents->tail;
- e->tail = 0;
- delete e;
- }
-
-template<class T> void List<T>::del_after(List_Iterator<T> i)
- {
-#if ! defined NDEBUG
- for (List_Element<T> *e0 = contents; e0 != &(i.element()); e0=e0->tail)
- {
- assert(e0);
- }
-#endif
- List_Element<T> *e = i.element().tail;
- i.element().tail = e->tail;
- e->tail = 0;
- delete e;
- }
-
-template<class T> void List<T>::clear()
- {
- delete contents;
- contents = 0;
- }
-
-template<class T> void List<T>::join(List<T> &consumed)
- {
- List_Element<T> *e = consumed.contents;
- consumed.contents = 0;
- *(end()) = e;
- }
-
-} // namespace
diff --git a/omegalib/omega/include/basic/Map.c b/omegalib/omega/include/basic/Map.c
deleted file mode 100644
index 69cc3f7..0000000
--- a/omegalib/omega/include/basic/Map.c
+++ /dev/null
@@ -1,63 +0,0 @@
-namespace omega {
-
-template<class K, class V> MapElement<K,V>:: MapElement(const MapElement<K,V>& M) {
- if (M.tail) tail = new MapElement<K,V>(*M.tail);
- else tail = 0;
- k = M.k;
- v = M.v;
- }
-
-template<class K, class V> MapElement<K,V> &
- MapElement<K,V>:: operator=(const MapElement<K,V>& M) {
- if (this != &M) {
- if (tail) delete tail;
- if (M.tail) tail = new MapElement<K,V>(*M.tail);
- else tail = 0;
- k = M.k;
- v = M.v;
- }
- return *this;
- }
-
-
-
-
-#if ! defined linux
-template <class K, class V> Map <K,V>::Map(const V &default_value)
-#else
-template <class K, class V> Map <K,V>::Map(V default_value)
-#endif
- : _default_value(default_value)
- {
- contents = 0;
- }
-
-template <class K, class V> Map <K,V>::~Map()
- {
- delete contents;
- }
-
-template <class K, class V> V Map<K,V>::operator()(K k) const {
- MapElement <K,V> * P = contents;
- while (P) {
- if (P->k == k) return P->v;
- P = P->tail;
- };
- return _default_value;
- }
-
-template <class K, class V> V & Map<K,V>::operator[](K k) {
- MapElement <K,V> * P = contents;
- while (P) {
- if (P->k == k) return P->v;
- P = P->tail;
- };
- P = new MapElement <K,V>;
- P->k = k;
- P->v = _default_value;
- P->tail = contents;
- contents = P;
- return P->v;
- }
-
-} // namespace
diff --git a/omegalib/omega/include/basic/Section.c b/omegalib/omega/include/basic/Section.c
deleted file mode 100644
index 754e002..0000000
--- a/omegalib/omega/include/basic/Section.c
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <assert.h>
-
-namespace omega {
-
-template <class T> Section<T>::Section(Sequence<T> *s, int start, int length)
- {
- assert(s->size() >= start-1 + length);
- it = s;
- _start = start;
- _length = length;
- }
-
-template <class T> Iterator<T> *Section<T>::new_iterator()
- {
- return new Section_Iterator<T>(*this);
- }
-
-template <class T> const T &Section<T>::operator[](int i) const
- {
- assert(1 <= i && i <= size());
- return (*it)[i+(_start-1)];
- }
-
-template <class T> T &Section<T>::operator[](int i)
- {
- assert(1 <= i && i <= size());
- return (*it)[i+(_start-1)];
- }
-
-template <class T> int Section<T>::index(const T &var) const
- {
- int i;
- for (i=1; i<=size(); i++)
- if ((*this)[i] == var)
- return i;
- return 0;
- }
-
-template <class T> int Section<T>::size() const
- {
- return _length;
- }
-
-
-template <class T> Section_Iterator<T>::Section_Iterator(Section<T> &sec)
- {
- it = sec.it->new_iterator();
- for (int i = 1; i < sec._start; i++)
- (*it)++;
- remaining = sec.size();
- }
-
-
-template <class T> Section_Iterator<T>::Section_Iterator(const Section_Iterator<T> &si) : it(si.it), remaining(si.remaining) {}
-
-
-template <class T> void Section_Iterator<T>::operator++()
- { this->operator++(0); }
-
-template <class T> void Section_Iterator<T>::operator++(int)
- {
- if (remaining > 0)
- {
- (*it)++;
- remaining--;
- }
- }
-
-template <class T> bool Section_Iterator<T>::live() const
- {
- return (remaining > 0);
- }
-
-template <class T> Iterator<T> *Section_Iterator<T>::new_copy() const
- {
- return new Section_Iterator<T>(*this);
- }
-
-} // namespace
diff --git a/omegalib/omega/include/basic/SimpleList.c b/omegalib/omega/include/basic/SimpleList.c
deleted file mode 100644
index da7de9b..0000000
--- a/omegalib/omega/include/basic/SimpleList.c
+++ /dev/null
@@ -1,105 +0,0 @@
-namespace omega {
-
-template<class T> Simple_List_Iterator<T>::Simple_List_Iterator(Simple_List<T> &l)
-: List_Element_Iterator<T>(l.contents) {}
-
-template<class T> Simple_List_Iterator<T>::Simple_List_Iterator(const Simple_List<T> &l)
-: List_Element_Iterator<T>(l.contents) {}
-
-template<class T> Simple_List_Iterator<T>::Simple_List_Iterator()
-: List_Element_Iterator<T>(0) {}
-
-template<class T> Iterator<T> *Simple_List<T>::new_iterator()
-{
- return new Simple_List_Iterator<T>(*this);
-}
-
-template<class T> const T &Simple_List<T>::operator[](int i) const
-{
- Simple_List_Iterator<T> p(*this);
-
- while(--i > 0 && p)
- p++;
-
- if (p)
- return *p;
- else
- return *((T *)0);
-}
-
-template<class T> T &Simple_List<T>::operator[](int i)
-{
- Simple_List_Iterator<T> p(*this);
-
- while(--i > 0 && p)
- p++;
-
- if (p)
- return *p;
- else
- return *((T *)0);
-}
-
-
-template<class T> int Simple_List<T>::size() const
- {
- int i = 0;
- List_Element<T> * p = contents;
- while (p)
- {
- p = p->tail;
- i++;
- }
- return i;
- }
-
-template<class T> T &Simple_List<T>::front() const
- {
- return contents->head;
- }
-
-template<class T> T Simple_List<T>::remove_front()
- {
- List_Element<T> *frunt = contents;
- contents = contents->tail;
- T fruntT = frunt->head;
- frunt->tail = 0;
- delete frunt;
- return fruntT;
- }
-
-template<class T> void Simple_List<T>::prepend(const T &item)
- {
- contents = new List_Element<T>(item, contents);
- }
-
-
-template<class T> void Simple_List<T>::append(const T &item)
- {
- *(end()) = new List_Element<T>(item, 0);
- }
-
-
-template<class T> void Simple_List<T>::del_front()
- {
- List_Element<T> *e = contents;
- contents = contents->tail;
- e->tail = 0;
- delete e;
- }
-
-
-template<class T> void Simple_List<T>::clear()
- {
- delete contents;
- contents = 0;
- }
-
-template<class T> void Simple_List<T>::join(Simple_List<T> &consumed)
- {
- List_Element<T> *e = consumed.contents;
- consumed.contents = 0;
- *(end()) = e;
- }
-
-} // namespace
diff --git a/omegalib/omega/include/basic/Tuple.c b/omegalib/omega/include/basic/Tuple.c
deleted file mode 100644
index ee6648f..0000000
--- a/omegalib/omega/include/basic/Tuple.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* class Tuple */
-
-// THESE FIRST TWO REALLY SHOULD BE INLINE BUT IT BREAKS CFRONT:
-
-namespace omega {
-
-template<class T> T &Tuple<T>::operator[](int index)
- {
- assert(1 <= index && index <= sz); return data[index-1];
- }
-
-template<class T> const T &Tuple<T>::operator[](int index) const
- {
- assert(1 <= index && index <= sz); return data[index-1];
- }
-
-
-template<class T> Tuple<T>::~Tuple()
- {
- if (data)
- delete [] data;
- }
-
-template<class T> Tuple<T>::Tuple() : sz(0), alloc_sz(0),
- prealloc_min(20),prealloc_pad(5), data(0)
-{
- // nothing needs be done
- }
-
-template<class T> Tuple<T>::Tuple(int size) : sz(size),
- prealloc_min(20),prealloc_pad(5)
-{
- if (sz > 0)
- {
- alloc_sz = prealloc_size(sz);
- data = new T[alloc_sz];
- assert(alloc_sz >= sz);
- //Need some handling for out of memory.
- assert (data!=0);
- }
- else {
- alloc_sz = 0;
- data = 0;
- }
-}
-
-
-template<class T> Tuple<T>::Tuple(const Tuple<T>& t)
- : sz(t.sz), alloc_sz(t.alloc_sz), prealloc_min(20),prealloc_pad(5)
-{
- if (sz > 0) {
- data = new T[alloc_sz];
- assert (data!=0);
- assert (alloc_sz >= sz);
- for (int i=0; i<sz; i++)
- data[i] = t.data[i];
- } else {
- data = 0;
- alloc_sz = 0; // THis might not be 0 if it was a "clear"ed Tuple
-// assert(alloc_sz == 0);
- }
-}
-
-
-template<class T> Tuple<T>& Tuple<T>::operator=(const Tuple<T>& t)
-{
- if (this != &t) { // Delete this
- if (data)
- delete [] data;
- sz = t.sz;
- alloc_sz = t.alloc_sz;
- assert(alloc_sz >= sz);
- if (sz > 0) { // Copy old
- data = new T[alloc_sz];
- assert (data!=0);
- for (int i=0; i<sz; i++)
- data[i] = t.data[i];
- } else {
- data=0;
- alloc_sz = 0; // THis might not be 0 if it was a "clear"ed Tuple
-// assert(alloc_sz == 0);
- }
- }
- return *this;
-}
-
-
-template<class T> void Tuple<T>::reallocate(const int req_size)
-{
- if (alloc_sz >= req_size) { // if (sz >= req_size), does this.
- sz = req_size;
- return;
- }
- alloc_sz = prealloc_size(req_size);
- T* tmp_data = new T[alloc_sz];
- for(int i=0;i<sz;i++)
- tmp_data[i] = data[i];
- delete [] data;
- data = tmp_data;
- sz = req_size;
- assert(alloc_sz >= req_size);
-}
-
-template<class T> void Tuple<T>::delete_last()
-{
-assert(sz > 0);
-sz --;
-}
-
-template<class T> void Tuple<T>::append(const T &v)
-{
- // Check if reallocation is necessary.
- if (sz == 0) { // Empty Tuple
- assert(alloc_sz >= 0); // May be nonzero for cleared tuple
-
- if(alloc_sz == 0) { // If it's > 1 no allocation is necessary
- alloc_sz = prealloc_size(1);
- data = new T[alloc_sz];
- }
- assert (alloc_sz > 0 && data != 0);
- } else {
- if(sz == alloc_sz) { // Requires new allocation
- alloc_sz = realloc_size(alloc_sz);
- T * data_tmp = new T[alloc_sz];
- assert (data_tmp!=0);
- assert (alloc_sz > sz);
- for (int i=0; i<sz; i++)
- data_tmp[i] = data[i];
- delete [] data;
- data=data_tmp;
- } // Otherwise big enough, no reallocation necessary
- }
- // Make assignment
- assert(alloc_sz >= sz);
- data[sz++] = v;
-}
-
-template<class T> void Tuple<T>::append(const Tuple<T>& t) {
- int old_sz = sz;
- reallocate(t.size()+size());
- assert(alloc_sz >= sz);
- for(int i=0; i<t.sz; i++)
- data[i+old_sz] = t.data[i];
-}
-
-template<class T> void Tuple<T>::join(Tuple<T>& t) {
- int old_sz = sz;
- reallocate(t.size()+size());
- assert(alloc_sz >= sz);
- for(int i=0; i<t.sz; i++)
- data[i+old_sz] = t.data[i];
- t.clear();ation will not fail, it would generate the object file but it won't generate any code for the template class in the object file.
-}
-
-template<class T> void Tuple<T>::clear() { if (sz) delete [] data; data = 0; alloc_sz = 0; sz = 0; }
-
-template<class T> int Tuple<T>::empty() const { return (sz == 0); }
-
-template<class T> Iterator<T> *Tuple<T>::new_iterator()
-{
- return new Tuple_Iterator<T>(*this);
-}
-
-template<class T> int Tuple<T>::index(const T & var) const
-/* returns index or 0 if var isn't in the tuple */
-{
- int i;
- for (i=0; i<sz; i++)
- if (data[i]== var)
- return i+1;
- return 0;
-}
-
-template<class T> bool Tuple<T>::operator == (const Tuple<T>& b) const
-{
- int i;
- if (sz != b.size()) return false;
- for (i=0; i<sz; i++)
- if (!(data[i] == b[i+1])) return false;
- return true;
-}
-
-/* class Tuple_Iterator */
-
-template<class T> Tuple_Iterator<T>::Tuple_Iterator(const Tuple<T> &tpl) :
-current(tpl.data), lastptr(tpl.data+tpl.sz-1), firstptr(tpl.data), sz(tpl.sz)
-{
-}
-
-template<class T> Tuple_Iterator<T>::Tuple_Iterator(T * cr, T *frst, T * lst,
- int insz)
- : current(cr), lastptr(lst), firstptr(frst), sz(insz)
-{
-}
-
-template<class T> const T & Tuple_Iterator<T>::operator*() const
-{
- assert (current<=lastptr && current>=firstptr);
- return *current;
-}
-
-template<class T> T & Tuple_Iterator<T>::operator*()
-{
- assert (current<=lastptr && current >=firstptr);
- return *current;
-}
-
-template<class T> void Tuple_Iterator<T>::operator++(int)
-{
- current++;
-}
-
-template<class T> void Tuple_Iterator<T>::operator++()
-{
- current++;
-}
-
-template<class T> void Tuple_Iterator<T>::operator--(int)
-{
- current--;
-}
-
-template<class T> void Tuple_Iterator<T>::operator--()
-{
- current--;
-}
-
-template<class T> void Tuple_Iterator<T>::set_to_last()
-{
- current = lastptr;
-}
-
-template<class T> void Tuple_Iterator<T>::set_to_first()
-{
- current = firstptr;
-}
-
-template<class T> void Tuple_Iterator<T>::set_position(const int req_pos)
-{
- assert(req_pos <= sz && 1 <= req_pos);
- current = firstptr + (req_pos - 1);
-}
-
-
-template<class T> bool Tuple_Iterator<T>::live() const
-{
- return (current !=0 && current<=lastptr && current >= firstptr);
-}
-
-template<class T> Iterator<T> *Tuple_Iterator<T>::new_copy() const {
- return new Tuple_Iterator<T>(current, firstptr, lastptr, sz);
-}
-
-} // namespace
diff --git a/omegalib/omega/include/basic/boolset-test.cc b/omegalib/omega/include/basic/boolset-test.cc
deleted file mode 100755
index 5b68220..0000000
--- a/omegalib/omega/include/basic/boolset-test.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "boolset.h"
-#include <iostream>
-
-using namespace omega;
-
-void foo(const BoolSet<> &B) {
- for (BoolSet<>::const_iterator i = B.begin(); i != B.end(); i++)
- std::cout << *i << ' ';
- std::cout << std::endl;
-}
-
-int main() {
- BoolSet<> A(13);
-
- A.set(2);
- std::cout << A << std::endl;
-
- A.set_all();
- std::cout << A << std::endl;
-
- A.unset_all();
- std::cout << A << std::endl;
-
- A.set(2);
- A.set(4);
-
- BoolSet<> B(13);
- B.set(2);
-
- std::cout << "A: " << A << std::endl;
- std::cout << "B: " << B << std::endl;
-
- std::cout << A.imply(B) << std::endl;
- std::cout << B.imply(A) << std::endl;
-
- B.set(10);
- std::cout << (A|B) << std::endl;
- std::cout << (A&B) << std::endl;
-
- BoolSet<> C(3);
- C.set(0);
- std::cout << (A|C) << std::endl;
- std::cout << ~(A|C) << std::endl;
-
- B = BoolSet<>(23);
- std::cout << "test iterator\n";
- B.set(12);
- B.set(11);
- B.set(0);
- std::cout << B << std::endl;
- for (BoolSet<>::const_iterator i = B.begin(); i != B.end(); i++) {
- std::cout << *i << ' ';
- if (*i == 11)
- B.unset(*i);
- }
- std::cout << std::endl;
- std::cout << B << std::endl;
- std::cout << std::endl;
- foo(B);
-
- std::cout << ~BoolSet<>(5) << std::endl;
-
- std::cout << "------\n";
- B.dump();
- std::cout << std::endl << *(B.begin()+1) << std::endl;
-
- for (BoolSet<>::iterator i = B.begin(); i != B.end(); i++)
- for (BoolSet<>::iterator j = i; j != B.end(); j++)
- if (j == i)
- std::cout << "ehh-";
-
-}