From: fred Date: Fri, 14 Feb 1997 22:58:02 +0000 (+0000) Subject: flower-1.0.27 X-Git-Tag: release/1.5.59~6336 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5efa6abfc17a15774f6a41a5e12182c34890c3e7;p=lilypond.git flower-1.0.27 --- diff --git a/flower/NEWS b/flower/NEWS index 6f4fd129cd..b89a032048 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,3 +1,6 @@ +pl 27 + - (temporarily?) removed findcursor* t*mat* + pl 26 - docxx 3.0 diff --git a/flower/Sources.make b/flower/Sources.make index 1e4fb2bc02..23d5164f0a 100644 --- a/flower/Sources.make +++ b/flower/Sources.make @@ -1,18 +1,13 @@ -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 path.cc +cc=choleski.cc dataf.cc dstream.cc lgetopt.cc matdebug.cc matrix.cc\ +path.cc scalar.cc smat.cc string.cc textdb.cc unionfind.cc vector.cc -templatecc=cursor.tcc list.tcc tsmat.tcc plist.tcc interval.tcc\ +templatecc=cursor.tcc list.tcc plist.tcc interval.tcc\ pcursor.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 varray.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 rational.hh iterate.hh\ - path.hh - - +inl=link.inl list.inl cursor.inl plist.inl +hh=assoc.hh associter.hh choleski.hh compare.hh cursor.hh dstream.hh\ +fproto.hh handle.hh interval.hh iterate.hh lgetopt.hh link.hh list.hh\ +matrix.hh path.hh pcursor.hh plist.hh rational.hh real.hh scalar.hh\ +smat.hh string.hh stringutil.hh textdb.hh textstr.hh unionfind.hh\ +varray.hh vector.hh vsmat.hh diff --git a/flower/Variables.make b/flower/Variables.make index 0dc6c79705..6d0cec88bd 100644 --- a/flower/Variables.make +++ b/flower/Variables.make @@ -1,6 +1,6 @@ MAJVER=1 MINVER=0 -PATCHLEVEL=26 +PATCHLEVEL=27 PACKAGENAME=flower diff --git a/flower/dstream.hh b/flower/dstream.hh index 0143eb0510..801b166774 100644 --- a/flower/dstream.hh +++ b/flower/dstream.hh @@ -1,4 +1,3 @@ -// debug_stream #ifndef DSTREAM_HH #define DSTREAM_HH @@ -10,8 +9,7 @@ const char eol= '\n'; template struct Assoc; -/// debug stream - /** +/** debug stream. a class for providing debug output of nested structures, with indents according to \{\}()[]. @@ -38,7 +36,7 @@ public: bool silence(String); /** - if rcfile == 0, then do not read any rc file + if rcfile == 0, then do not read any rc file. */ Dstream(ostream *r, const char * rcfile); diff --git a/flower/findcurs.hh b/flower/findcurs.hh deleted file mode 100644 index e46b64dcd9..0000000000 --- a/flower/findcurs.hh +++ /dev/null @@ -1,12 +0,0 @@ -template -class FindCursor : public Cursor -{ -public: - FindCursor( List& list, Link* pointer = 0 ); - FindCursor( const Cursor& cursor ); - - Cursor operator =( const Cursor& c ); - FindCursor find( const T& thing ); -}; - -#include "findcurs.inl" diff --git a/flower/findcurs.inl b/flower/findcurs.inl deleted file mode 100644 index 593d4aae10..0000000000 --- a/flower/findcurs.inl +++ /dev/null @@ -1,37 +0,0 @@ -template -inline -FindCursor::FindCursor( List& list, Link* pointer ) : - Cursor( list, pointer ) -{ -} - -template -inline -FindCursor::FindCursor( const Cursor& cursor ) : - Cursor( cursor ) -{ -} - -template -Cursor -FindCursor::operator =( const Cursor& c ) -{ - ( (Cursor&)*this ) = c; - return *this; -} - -template -inline FindCursor -FindCursor::find( const T& thing ) -{ - Cursor c( *this ); - while( c.forward() ) - { - T& look = *c; - if ( U::equal( look, thing ) ) - return c; - c++; - } - - return FindCursor( *this ); // cursor is not .ok() -} diff --git a/flower/handle.hh b/flower/handle.hh index 921dc6031c..63c17ef1d2 100644 --- a/flower/handle.hh +++ b/flower/handle.hh @@ -1,5 +1,6 @@ #ifndef HANDLE_HH #define HANDLE_HH + /// reference counting handle template class Handle { diff --git a/flower/iterate.hh b/flower/iterate.hh index 33dbb16a4c..1e924f0790 100644 --- a/flower/iterate.hh +++ b/flower/iterate.hh @@ -1,3 +1,16 @@ +/* + iterate.hh -- define some list macros + + source file of the flowerlib + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef ITERATE_HH +#define ITERATE_HH + + #define iterator(set) typeof((set).top()) #define iterator_bot(set) typeof((set).bottom()) @@ -6,3 +19,4 @@ #define iter_top(set,var) iterator(set) var(set) #define iter_bot(set,var) iterator(set) var(set.bottom()) +#endif // ITERATE_HH diff --git a/flower/tsmat.hh b/flower/tsmat.hh deleted file mode 100644 index e8dac44e6e..0000000000 --- a/flower/tsmat.hh +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef SMAT_HH -#define SMAT_HH -#include "varray.hh" -#include "vsmat.hh" - -/// simplest matrix storage. refer to its baseclass for the doco. -template -class Full_storage : public virtual_smat -{ - /// height, width - int h,w; - /// maxima. - int maxh, maxw; - - /// the storage - T** els; - void - init() { - els=0; - h=w=maxh=maxw=0; - - } - - bool valid(int i, int j) const { - return (i>=0 && i < h) - && (j < w && j >=0); - } - - - void resize_rows(int); - void resize_cols(int); - -public: - virtual int rows() const { - return h; - } - virtual int cols() const { - return w; - } - - - virtual void set_size(int i, int j) - { - resize(i,j); //this could be more efficient. - } - - virtual void set_size(int i) { - set_size(i,i); - } - virtual void resize(int i, int j); - virtual void resize(int i) { - resize(i,i); - } - - virtual T& elem(int i,int j) { - assert(valid(i,j)); - return els[i][j]; - } - virtual const T& elem(int i, int j) const { - assert(valid(i,j)); - return els[i][j]; - } - virtual Array row(int i) const; - virtual Array column(int j) const; - - Full_storage() { - init(); - } - Full_storage(int i, int j) { - init(); - set_size(i,j); - } - Full_storage(int i) { - init(); - set_size(i); - } - void OK() const; - void operator=(Full_storage const &); - - virtual void insert_row(int k); - virtual void delete_row(int k); - - - ~Full_storage(); - virtual bool mult_ok(int i, int j)const; - virtual void mult_next(int &i, int &j) const ; - virtual bool trans_ok(int i, int j) const; - virtual void trans_next(int &i, int &j) const; - -}; - -#endif diff --git a/flower/tsmat.tcc b/flower/tsmat.tcc deleted file mode 100644 index 0e5407ae70..0000000000 --- a/flower/tsmat.tcc +++ /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; diff --git a/flower/tvsmat.hh b/flower/tvsmat.hh deleted file mode 100644 index 847c650b48..0000000000 --- a/flower/tvsmat.hh +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef VSMAT_HH -#define VSMAT_HH -#include "varray.hh" - -/// a matrix storage baseclass. -/** base class for interface with matrix storageclasses. There are no - iterators for matrixclasses, since matrices are (like arrays) - explicitly int-indexed. - - Iteration is provided by *_next, *_ok, which update and check both - index variables simultaneously. - - TODO - determine type of product matrix. - -*/ -class virtual_smat { - - -public: - /// check invariants - virtual void OK() const=0; - - /// height of matrix - virtual int rows() const = 0; - - /// width of matrix - virtual int cols() const = 0; - - /// set the size. contents lost - /** - PRE - i >=0, j>=0 - */ - virtual void set_size(int i, int j) = 0; - - /// set the size to square dimen. contents lost - virtual void set_size(int i) = 0; - /** - PRE - i>=0 - */ - /// set the size to i,j - /** - - keep contents. If enlarged contents unspecified - - PRE - i>=0, j>=0 - - */ - virtual void resize(int i, int j) = 0; - - /// set the size to square dimen. contents kept - /** - Keep contents. If enlarged contents are unspecified - - PRE - i>=0 - */ - virtual void resize(int i) = 0; - - /// access an element - /** - access an element. - - Generate an errormessage, if this happens - in the 0-part of a sparse matrix. - */ - - virtual Real& elem(int i,int j) = 0; - /// access a element, no modify - virtual const Real& elem(int i, int j) const = 0; - -#if 1 - virtual Array row(int i) const = 0; - virtual Array column(int j) const = 0; -#endif - - /// add a row - /** - add a row to the matrix before row k. Contents - of added row are unspecified - - 0 <= k <= rows() - */ - virtual void insert_row(int k)=0; - - /// delete a row - /** - delete a row from this matrix. - - PRE - 0 <= k < rows(); - */virtual void delete_row(int k)=0; - - virtual ~virtual_smat() { } - virtual virtual_smat *clone()=0; - - - /// is there a next? - /** - at end of matrix? when doing loop - - for(i=0; i *get_full(int n, int m); - -}; - - -#endif diff --git a/flower/unionfind.hh b/flower/unionfind.hh index 523321ff5f..fbaa51e731 100644 --- a/flower/unionfind.hh +++ b/flower/unionfind.hh @@ -2,7 +2,16 @@ #define UNIONFIND_HH #include "varray.hh" -/// which points of a graph are connected? +/* + which points of a graph are connected?. + Union find, a standard algorithm: + + Union_find represents an undirected graph of N points. You can + connect two points using #connect()#. #find(i)# finds a uniquely + determined representant of the equivalence class of points + connected to #i#. + + */ struct Union_find { void connect(int i, int j); int find(int i); @@ -13,13 +22,4 @@ private: Array classes; }; -/* - Union find, a standard algorithm: - - Union_find represents an undirected graph of N points. You can - connect two points using #connect()#. #find(i)# finds a uniquely - determined representant of the equivalence class of points - connected to #i#. - - */ #endif