From a9631e1fae040037fbe1499b7bda5a9c26b7b080 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 1 Jan 1997 14:13:15 +0000 Subject: [PATCH] flower-1.0.18 --- flower/Sources.make | 6 +- flower/cursor.cc | 107 ------------------------------- flower/interval.cc | 93 --------------------------- flower/list.cc | 113 --------------------------------- flower/plist.cc | 22 ------- flower/tsmat.cc | 151 -------------------------------------------- 6 files changed, 4 insertions(+), 488 deletions(-) delete mode 100644 flower/cursor.cc delete mode 100644 flower/interval.cc delete mode 100644 flower/list.cc delete mode 100644 flower/plist.cc delete mode 100644 flower/tsmat.cc diff --git a/flower/Sources.make b/flower/Sources.make index 84e27c4681..2a618814c3 100644 --- a/flower/Sources.make +++ b/flower/Sources.make @@ -3,12 +3,14 @@ cc=lgetopt.cc string.cc dataf.cc textdb.cc unionfind.cc \ smat.cc matrix.cc choleski.cc vector.cc dstream.cc\ matdebug.cc scalar.cc -templatecc=cursor.cc list.cc tsmat.cc plist.cc interval.cc +templatecc=cursor.tcc list.tcc tsmat.tcc plist.tcc interval.tcc + inl=findcurs.inl link.inl list.inl cursor.inl plist.inl hh=cursor.hh pcursor.hh lgetopt.hh link.hh list.hh dstream.hh \ string.hh stringutil.hh vray.hh textdb.hh textstr.hh assoc.hh\ findcurs.hh unionfind.hh compare.hh handle.hh matrix.hh\ smat.hh vsmat.hh vector.hh real.hh choleski.hh\ tsmat.hh tvsmat.hh plist.hh associter.hh fproto.hh\ - interval.hh scalar.hh sstack.hh rational.hh + interval.hh scalar.hh sstack.hh rational.hh iterate.hh\ + diff --git a/flower/cursor.cc b/flower/cursor.cc deleted file mode 100644 index 3d2116c46f..0000000000 --- a/flower/cursor.cc +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef CURSOR_CC -#define CURSOR_CC - -#include "cursor.hh" -#include - -template - void -Cursor::backspace() -{ - Cursor c(*this); - c--; - list_.remove( *this ); -} - -template - void -Cursor::del() -{ - Cursor c(*this); - c++; - list_.remove( *this ); - *this = c; -} - - -template -Cursor -Cursor::operator -=( int j ) -{ - while (j--) - (*this)--; - return *this; -} -template -Cursor -Cursor::operator +=( int j ) -{ - while (j++) - (*this)++; - return *this; -} - -template -Cursor -Cursor::operator +( int i ) const -{ - Cursor r = *this; - - if (i<0) - return r -(-i); - - while (i--) - r++; - - return r; -} - -template -Cursor -Cursor::operator -( int i ) const -{ - Cursor r = *this; - if (i<0) - return r +(-i); - - while (i--) - r--; - - return r; -} -/* - warning: can't use Cursor::operator == (Cursor), - since it uses Cursor::operator-(Cursor) - */ -template -int -Cursor::operator-(Cursor rhs) const -{ - assert(rhs.list == list); - int dif = 0; - - // search from *this on further up (positive difference) - Cursor c(*this); - while (c.ok() && c.pointer_ != rhs.pointer_) { - c--; - dif++; - } - - if (c.ok()) - goto gotcha; // so, sue me. - - // search in direction of bottom. (negative diff) - dif =0; - c=*this; - while (c.ok() && c.pointer_ !=rhs.pointer_) { - dif --; - c++; - } - assert(c.ok()); - -gotcha: - assert((*this - dif).pointer_ == c.pointer_); - return dif; -} - -#endif diff --git a/flower/interval.cc b/flower/interval.cc deleted file mode 100644 index 46b4fc7e16..0000000000 --- a/flower/interval.cc +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include "interval.hh" -#include "string.hh" - - - -template -int -Interval__compare(const Interval_t&a,Interval_t const&b) -{ - if (a.left == b.left && a.right == b.right) - return 0; - - if (a.left <= b.left && a.right >= b.right) - return 1; - - if (a.left >= b.left && a.right <= b.right) - return -1; - - assert(false); // not comparable - - return 0; -} - -const Real INFTY = HUGE; - -template -void -Interval_t::set_empty() { - left = INFTY; - right = -INFTY; -} - -template -T -Interval_t::length() const { - assert(right >= left); - return right-left; -} - -template -void -Interval_t::unite(Interval_t h) -{ - if (h.leftright) - right = h.right; -} - -/** - smallest Interval which includes *this and #h# - */ - -template -void -Interval_t::intersect(Interval_t h) -{ -#if defined (__GNUG__) && ! defined (__STRICT_ANSI__) - left = h.left >? left; - right = h.right -Interval_t -intersect(Interval_t x, Interval_t const &y) -{ - x.intersect(y); - return x; -} - -template -String -Interval_t::str() const -{ - if (empty()) - return "[empty]"; - String s("["); - - return s + left + "," + right +"]"; -} - -template -bool -Interval_t::elt_q(T r) -{ - return r >= left && r <= right; -} diff --git a/flower/list.cc b/flower/list.cc deleted file mode 100644 index 55e1e20507..0000000000 --- a/flower/list.cc +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef LIST_CC -#define LIST_CC - -#include "list.hh" - -template -List::List(List const&src) -{ - set_empty(); - // probably el stupido - for (Cursor c(src); c.ok(); c++) - bottom().add(c); -} - -template -void -List::OK() const -{ - int i = size_; - Link *lp = top_; - while (i--) { - assert(lp); - lp->OK(); - lp = lp->next(); - } - assert(!lp); - i = size_; - lp = bottom_; - while (i--) { - assert(lp); - lp->OK(); - lp = lp->previous(); - } - assert(!lp); -} - - -template -List::~List() -{ - Cursor next(*this); - for ( Cursor c( *this ); c.ok(); c = next ) { - next = c; - next++; - remove( c ); - } -} - -template -void -List::add( const T& thing, Cursor &after_me ) -{ - if (!size_) { // not much choice if list is empty - bottom_ = top_ = new Link( thing ); - if (!after_me.ok()) - after_me = bottom(); - } else { // add at aprioprate place - if (!after_me.ok()) - after_me = bottom(); - Link *p =after_me.pointer(); - p->add(thing); - if (p == bottom_) // adjust bottom_ if necessary. - bottom_ = p->next(); - } - - size_++; -} -/** - - Procedure: - \begin{itemize} - \item if #after_me# is #ok()#, add after #after_me#, else - \item if list !empty simply add to bottom, else - \item list is empty: create first \Ref{Link} and initialize - #bottom_# and #top_#. - \end{itemize} -*/ - -template -void -List::insert( const T& thing, Cursor &before_me ) -{ - if (!size_) { - bottom_ = top_ = new Link( thing ); - if (!before_me.ok()) - before_me = top(); - - } else { - if (!before_me.ok()) - before_me = top(); - - Link *p = before_me.pointer() ; - - p->insert(thing); - if (p == top_) - top_ = p->previous(); - } - - size_++; -} - - -template -void -List::concatenate(List const&s) -{ - Cursor b(bottom()); - for (Cursor c(s); c.ok(); c++) { - b.add(c); - b++; - } -} -#endif diff --git a/flower/plist.cc b/flower/plist.cc deleted file mode 100644 index 2581d24279..0000000000 --- a/flower/plist.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include "plist.hh" - -// not inlined since it assumes knowledge of destructor. -template -void -IPointerList::remove(PCursor me ) -{ - if ( me.ok() ) { - delete me.ptr(); - List::remove(me); - } -} -template -PCursor -PointerList::find(T what ) const -{ - PCursor i(*this); - for (; i.ok(); i++) - if (i.ptr() == what) - break; - return i; -} diff --git a/flower/tsmat.cc b/flower/tsmat.cc deleted file mode 100644 index 0e5407ae70..0000000000 --- a/flower/tsmat.cc +++ /dev/null @@ -1,151 +0,0 @@ -#include "smat.hh" - -template -void -Full_storage::operator=(Full_storage const &fs) -{ - resize(fs.h, fs.w); - for (int i=0; i -void -Full_storage::OK() const -{ - assert(maxh >= h && maxw >= w); - assert(h >= 0 && w >= 0); -} -template -void -Full_storage::resize_cols(int newh) -{ - if (newh <= maxh) { - h=newh; - return; - } - - T** newa=new T*[newh]; - int j=0; - for (; j < h; j++) - newa[j] = els[j]; - for (; j < newh; j++) - newa[j] = new T[w]; - delete[] els; - els=newa; - maxh = newh; -} - -template -void -Full_storage::resize_rows(int neww) -{ - if (neww <= maxw) { - w=neww; - return; - } - for (int i=0; i < h ; i++) { - T* newa=new T[neww]; - for (int k=0; k < w; k++) - newa[k] = els[i][k]; - - delete[] els[i]; - els[i] = newa; - maxw = neww; - } -} - -template -Full_storage::~Full_storage() { - for (int i=0; i < maxh; i++) - delete [] els[i]; - delete[] els; -} - -template -void -Full_storage::resize(int i, int j) -{ - resize_cols(i); - resize_rows(j); -} - -template -void -Full_storage::set_size(int i, int j) -{ - resize(i,j) -} - -template -bool -Full_storage::mult_ok(int i, int j) const -{ - return valid(i,j); -} - -template -bool -Full_storage::trans_ok(int i, int j) const -{ - return valid(i,j); -} - - -template -void -Full_storage::trans_next(int &i, int &j) const -{ - assert(trans_ok(i,j)); - i++; - if (i >= h) { - i=0; - j ++; - } -} - -template -void -Full_storage::mult_next(int &i, int &j) const -{ - assert(mult_ok(i,j)); - j++; - if (j >= w) { - j=0; - i++; - } -} - -template -void -Full_storage::delete_row(int k) -{ - assert(0 <= k k ; i++) - for (int j=0; j < w; j++) - els[i-1][j]=els[i][j]; -} - -template -void -Full_storage::insert_row(int k) -{ - assert(0 <= k <=h); - resize_cols(h+1); - for (int i=h-1; i > k ; i++) - for (int j=0; j -virtual_smat * -virtual_smat::get_full(int n, int m) -{ - return new Full_storage(n,m); -} -#include "real.hh" - -template Full_storage; -- 2.39.5