From: fred Date: Sun, 24 Mar 2002 19:55:16 +0000 (+0000) Subject: lilypond-0.1.8 X-Git-Tag: release/1.5.59~4030 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=89b23430fa9f133cb690bfe9115fe1b5c42a8c70;p=lilypond.git lilypond-0.1.8 --- diff --git a/flower/choleski.cc b/flower/choleski.cc index 086759193f..eae3c49cea 100644 --- a/flower/choleski.cc +++ b/flower/choleski.cc @@ -13,93 +13,93 @@ const Real EPS = 1e-7; // so sue me. Hard coded //#define PARANOID void -Choleski_decomposition::full_matrix_solve(Vector &out, Vector const &rhs)const +Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs)const { int n= rhs.dim(); - assert(n == L.dim()); + assert (n == L.dim()); Vector y; - y.set_dim( n); - out.set_dim(n); + y.set_dim (n); + out.set_dim (n); // forward substitution for (int i=0; i < n; i++) { - Real sum(0.0); + Real sum (0.0); for (int j=0; j < i; j++) - sum += y(j) * L(i,j); - y(i) = (rhs(i) - sum)/L(i,i); + sum += y (j) * L(i,j); + y (i) = (rhs (i) - sum)/L(i,i); } for (int i=0; i < n; i++) - y(i) /= D(i); + y (i) /= D(i); // backward subst - Vector &x(out); // using input as return val. + Vector &x (out); // using input as return val. for (int i=n-1; i >= 0; i--) { - Real sum(0.0); + Real sum (0.0); for (int j=i+1; j < n; j++) - sum += L(j,i)*x(j); - x(i) = (y(i) - sum)/L(i,i); + sum += L(j,i)*x (j); + x (i) = (y (i) - sum)/L(i,i); } } void -Choleski_decomposition::band_matrix_solve(Vector &out, Vector const &rhs)const +Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs)const { int n= rhs.dim(); int b = L.band_i(); - assert(n == L.dim()); + assert (n == L.dim()); - out.set_dim(n); + out.set_dim (n); Vector y; - y.set_dim(n); + y.set_dim (n); // forward substitution for (int i=0; i < n; i++) { - Real sum(0.0); + Real sum (0.0); for (int j= 0 >? i - b; j < i; j++) - sum += y(j) * L(i,j); - y(i) = (rhs(i) - sum)/L(i,i); + sum += y (j) * L(i,j); + y (i) = (rhs (i) - sum)/L(i,i); } for (int i=0; i < n; i++) - y(i) /= D(i); + y (i) /= D(i); // backward subst - Vector &x(out); // using input as return val. + Vector &x (out); // using input as return val. for (int i=n-1; i >= 0; i--) { - Real sum(0.0); + Real sum (0.0); for (int j=i+1; j <= i + b&&j < n ; j++) - sum += L(j,i)*x(j); - x(i) = (y(i) - sum)/L(i,i); + sum += L(j,i)*x (j); + x (i) = (y (i) - sum)/L(i,i); } } void -Choleski_decomposition::solve(Vector &x, Vector const &rhs)const +Choleski_decomposition::solve (Vector &x, Vector const &rhs)const { if (L.band_b()) { - band_matrix_solve(x,rhs); + band_matrix_solve (x,rhs); } else - full_matrix_solve(x,rhs); + full_matrix_solve (x,rhs); } Vector -Choleski_decomposition::solve(Vector rhs)const +Choleski_decomposition::solve (Vector rhs)const { Vector r; - solve(r, rhs); + solve (r, rhs); return r; } void -Choleski_decomposition::full_matrix_decompose(Matrix const & P) +Choleski_decomposition::full_matrix_decompose (Matrix const & P) { int n = P.dim(); L.unit(); for (int k= 0; k < n; k++) { for (int j = 0; j < k; j++){ - Real sum(0.0); + Real sum (0.0); for (int l=0; l < j; l++) sum += L(k,l)*L(j,l)*D(l); L(k,j) = (P(k,j) - sum)/D(j); @@ -107,7 +107,7 @@ Choleski_decomposition::full_matrix_decompose(Matrix const & P) Real sum=0.0; for (int l=0; l < k; l++) - sum += sqr(L(k,l))*D(l); + sum += sqr (L(k,l))*D(l); Real d = P(k,k) - sum; D(k) = d; } @@ -115,7 +115,7 @@ Choleski_decomposition::full_matrix_decompose(Matrix const & P) } void -Choleski_decomposition::band_matrix_decompose(Matrix const &P) +Choleski_decomposition::band_matrix_decompose (Matrix const &P) { int n = P.dim(); int b = P.band_i(); @@ -123,7 +123,7 @@ Choleski_decomposition::band_matrix_decompose(Matrix const &P) for (int i= 0; i < n; i++) { for (int j = 0 >? i - b; j < i; j++){ - Real sum(0.0); + Real sum (0.0); for (int l=0 >? i - b; l < j; l++) sum += L(i,l)*L(j,l)*D(l); L(i,j) = (P(i,j) - sum)/D(j); @@ -131,12 +131,12 @@ Choleski_decomposition::band_matrix_decompose(Matrix const &P) Real sum=0.0; for (int l=0 >? i - b; l < i; l++) - sum += sqr(L(i,l))*D(l); + sum += sqr (L(i,l))*D(l); Real d = P(i,i) - sum; D(i) = d; } L.try_set_band(); - assert ( L.band_i() == P.band_i()); + assert ( L.band_i() == P.band_i ()); } @@ -146,20 +146,20 @@ Choleski_decomposition::band_matrix_decompose(Matrix const &P) Standard matrix algorithm. */ -Choleski_decomposition::Choleski_decomposition(Matrix const & P) - : L(P.dim()), D(P.dim()) +Choleski_decomposition::Choleski_decomposition (Matrix const & P) + : L(P.dim()), D(P.dim ()) { #ifdef PARANOID - assert((P-P.transposed()).norm()/P.norm() < EPS); + assert ((P-P.transposed()).norm ()/P.norm () < EPS); #endif if (P.band_b()) - band_matrix_decompose(P); + band_matrix_decompose (P); else - full_matrix_decompose(P); + full_matrix_decompose (P); #ifdef PARANOID - assert((original()-P).norm() / P.norm() < EPS); + assert ((original()-P).norm () / P.norm () < EPS); #endif } @@ -167,7 +167,7 @@ Matrix Choleski_decomposition::original() const { Matrix T(L.dim()); - T.set_diag(D); + T.set_diag (D); return L*T*L.transposed(); } @@ -175,20 +175,20 @@ Matrix Choleski_decomposition::inverse() const { int n=L.dim(); - Matrix invm(n); - Vector e_i(n); - Vector inv(n); + Matrix invm (n); + Vector e_i (n); + Vector inv (n); for (int i = 0; i < n; i++) { - e_i.set_unit(i); - solve(inv, e_i); + e_i.set_unit (i); + solve (inv, e_i); for (int j = 0 ; j=0); - Full_storage f(dim(), 2*s+1); + assert (s>=0); + Full_storage f (dim(), 2*s+1); for (int i=0; i < dim(); i++) { int k=-s; for ( ; k < -band_size_i(); k++) - f.elem(i,k + s) = 0.0; + f.elem (i,k + s) = 0.0; for ( ; k <= band_size_i()&& k<=s ; k++) - f.elem(i, k + s) = band_.elem(i,k+ band_size_i()); - for( ; k <= s; k++) - f.elem(i, k + s) =0.0; + f.elem (i, k + s) = band_.elem (i,k+ band_size_i()); + for (; k <= s; k++) + f.elem (i, k + s) =0.0; } band_ = f; @@ -70,31 +70,31 @@ Diagonal_storage::set_band_size(int s) any takers? */ void -Diagonal_storage::insert_row(int ) +Diagonal_storage::insert_row (int) { - assert(false); + assert (false); } void -Diagonal_storage::delete_row(int ) +Diagonal_storage::delete_row (int) { - assert(false); + assert (false); } void -Diagonal_storage::resize(int,int) +Diagonal_storage::resize (int,int) { } void -Diagonal_storage::resize(int) +Diagonal_storage::resize (int) { } void -Diagonal_storage::delete_column(int ) +Diagonal_storage::delete_column (int) { - assert(false); + assert (false); } Diagonal_storage::~Diagonal_storage() @@ -103,26 +103,26 @@ Diagonal_storage::~Diagonal_storage() bool -Diagonal_storage::band_elt_b(int i,int j)const +Diagonal_storage::band_elt_b (int i,int j)const { - return abs(i-j) <= band_size_i(); + return abs (i-j) <= band_size_i(); } void -Diagonal_storage::assert_valid(int i,int j )const +Diagonal_storage::assert_valid (int i,int j)const { - assert( band_elt_b(i,j) ); - assert( i >=0 && j >=0 && i < dim() && j < dim()); + assert (band_elt_b (i,j)); + assert (i >=0 && j >=0 && i < dim() && j < dim ()); } void -Diagonal_storage::resize_dim(int d) +Diagonal_storage::resize_dim (int d) { - Full_storage f(d, 2*band_size_i()+1); + Full_storage f (d, 2*band_size_i()+1); for (int i=0; i < d && i < dim(); i++) { for ( int k=0; k < 2*band_size_i(); k++) - f.elem(i,k) = elem(i,k); + f.elem (i,k) = elem (i,k); } band_ = f; @@ -131,37 +131,37 @@ Diagonal_storage::resize_dim(int d) bool -Diagonal_storage::mult_ok(int i,int )const +Diagonal_storage::mult_ok (int i,int)const { return i < dim(); } void -Diagonal_storage::mult_next(int &i, int &j)const +Diagonal_storage::mult_next (int &i, int &j)const { j++; - if ( j < i - band_size_i() ) + if ( j < i - band_size_i()) j = i- band_size_i(); - if ( j > i + band_size_i() || j >= dim() ) { + if ( j > i + band_size_i() || j >= dim ()) { i++; j = 0 >? i - band_size_i(); } } bool -Diagonal_storage::trans_ok(int ,int j)const +Diagonal_storage::trans_ok (int ,int j)const { return j < dim(); } void -Diagonal_storage::trans_next(int &i, int& j)const +Diagonal_storage::trans_next (int &i, int& j)const { i++; if ( i < j - band_size_i()) i = j-band_size_i(); - if ( i >= dim() || i > j + band_size_i() ) { + if ( i >= dim() || i > j + band_size_i ()) { j++; i = 0 >? j - band_size_i(); } @@ -170,26 +170,26 @@ Diagonal_storage::trans_next(int &i, int& j)const static Real nul_entry=0.0; Real -Diagonal_storage::elem(int i, int j)const +Diagonal_storage::elem (int i, int j)const { - if (abs ( i-j ) > band_size_i()) + if (abs ( i-j) > band_size_i()) return 0; else - return band_.elem(i, j - i +band_size_i()); + return band_.elem (i, j - i +band_size_i()); } Real & -Diagonal_storage::elem(int i, int j) +Diagonal_storage::elem (int i, int j) { /* if this fails, the previous call fucked up */ - assert(!nul_entry); + assert (!nul_entry); - if (abs ( i-j ) > band_size_i()) + if (abs ( i-j) > band_size_i()) return nul_entry; else - return band_.elem(i, j - i + band_size_i()); + return band_.elem (i, j - i + band_size_i()); } /* @@ -197,10 +197,10 @@ Diagonal_storage::elem(int i, int j) */ bool -Diagonal_storage::try_right_multiply(Matrix_storage*dest, +Diagonal_storage::try_right_multiply (Matrix_storage*dest, const Matrix_storage*right)const { - if ( right->name() != Diagonal_storage::static_name() ) + if ( right->name() != Diagonal_storage::static_name ()) return false; const Diagonal_storage* right_diag = (Diagonal_storage const*)right; @@ -216,8 +216,8 @@ Diagonal_storage::try_right_multiply(Matrix_storage*dest, int relk = startk + band_size_i() -i; Real sum =0.0; for ( int k = startk; k <= stopk; k++) - sum += band_.elem(i, relk++) * right_diag->elem(k, j); - dest->elem(i, j) = sum; + sum += band_.elem (i, relk++) * right_diag->elem (k, j); + dest->elem (i, j) = sum; } } @@ -227,13 +227,13 @@ Diagonal_storage::try_right_multiply(Matrix_storage*dest, IMPLEMENT_IS_TYPE_B1(Diagonal_storage, Matrix_storage); -Diagonal_storage::Diagonal_storage(Matrix_storage*stor_l, int band_i) +Diagonal_storage::Diagonal_storage (Matrix_storage*stor_l, int band_i) { - set_band_size(band_i); - resize_dim(stor_l->dim()); + set_band_size (band_i); + resize_dim (stor_l->dim()); - for ( int i=0,j=0; mult_ok(i,j); mult_next(i,j)) - band_.elem(i, j + band_i -i ) = stor_l->elem(i,j); + for ( int i=0,j=0; mult_ok (i,j); mult_next (i,j)) + band_.elem (i, j + band_i -i) = stor_l->elem (i,j); } void diff --git a/flower/directed-graph.cc b/flower/directed-graph.cc index a08f456381..2c55688011 100644 --- a/flower/directed-graph.cc +++ b/flower/directed-graph.cc @@ -30,15 +30,15 @@ Directed_graph_node::get_out_edge_arr()const /** Should not copy deps automatically */ -Directed_graph_node::Directed_graph_node(Directed_graph_node const&) +Directed_graph_node::Directed_graph_node (Directed_graph_node const&) { } void -Directed_graph_node::copy_edges_out(Directed_graph_node const &s) +Directed_graph_node::copy_edges_out (Directed_graph_node const &s) { - for(int i=0; i < s.edge_out_l_arr_.size(); i++) - add(s.edge_out_l_arr_[i]); + for (int i=0; i < s.edge_out_l_arr_.size(); i++) + add (s.edge_out_l_arr_[i]); } void @@ -46,37 +46,37 @@ Directed_graph_node::OK() const { #ifndef NDEBUG for (int i=0; i < edge_out_l_arr_.size(); i++) { - assert(edge_out_l_arr_[i]-> - edge_in_l_arr_.find_l(this)); + assert (edge_out_l_arr_[i]-> + edge_in_l_arr_.find_l (this)); } for (int i=0; i < edge_in_l_arr_.size(); i++) - assert(edge_in_l_arr_[i]->contains_b( this)); + assert (edge_in_l_arr_[i]->contains_b (this)); #endif } bool -Directed_graph_node::contains_b(const Directed_graph_node *d)const +Directed_graph_node::contains_b (const Directed_graph_node *d)const { - return edge_out_l_arr_.find_l((Directed_graph_node*)d); + return edge_out_l_arr_.find_l ((Directed_graph_node*)d); } void -Directed_graph_node::remove_edge_out_idx(int i) +Directed_graph_node::remove_edge_out_idx (int i) { PARANOID_OK(); - Directed_graph_node * d_l = edge_out_l_arr_.get(i); + Directed_graph_node * d_l = edge_out_l_arr_.get (i); - int j = d_l->edge_in_l_arr_.find_i(this); - assert(j>=0); - d_l->edge_in_l_arr_.unordered_del(j); + int j = d_l->edge_in_l_arr_.find_i (this); + assert (j>=0); + d_l->edge_in_l_arr_.unordered_del (j); PARANOID_OK(); } void -Directed_graph_node::remove_edge_in(Directed_graph_node *d_l) +Directed_graph_node::remove_edge_in (Directed_graph_node *d_l) { PARANOID_OK(); - d_l->remove_edge_out(this); + d_l->remove_edge_out (this); PARANOID_OK(); } @@ -84,9 +84,9 @@ void Directed_graph_node::remove_edge_out (Directed_graph_node *d_l) { PARANOID_OK(); - for (int i=0; i < edge_out_l_arr_.size(); ) { + for (int i=0; i < edge_out_l_arr_.size();) { if (edge_out_l_arr_[i]== d_l) - remove_edge_out_idx(i); + remove_edge_out_idx (i); else i++; } @@ -95,14 +95,14 @@ Directed_graph_node::remove_edge_out (Directed_graph_node *d_l) bool Directed_graph_node::linked_b()const { - return edge_out_l_arr_.size() || edge_in_l_arr_.size(); + return edge_out_l_arr_.size() || edge_in_l_arr_.size (); } void Directed_graph_node::junk_links() { - edge_in_l_arr_.set_size(0); - edge_out_l_arr_.set_size(0); + edge_in_l_arr_.set_size (0); + edge_out_l_arr_.set_size (0); } @@ -113,14 +113,14 @@ Directed_graph_node::unlink() PARANOID_OK(); Link_array t = edge_out_l_arr_; - t.concat(edge_in_l_arr_); + t.concat (edge_in_l_arr_); #endif - while ( edge_out_l_arr_.size() ) - remove_edge_out_idx(0); + while ( edge_out_l_arr_.size()) + remove_edge_out_idx (0); - while (edge_in_l_arr_.size() ) - remove_edge_in(edge_in_l_arr_[0]); + while (edge_in_l_arr_.size()) + remove_edge_in (edge_in_l_arr_[0]); #ifdef PARANOID for (int i =0; i < t.size(); i++) @@ -130,18 +130,18 @@ Directed_graph_node::unlink() Directed_graph_node::~Directed_graph_node() { - assert(!linked_b()); + assert (!linked_b()); } void -Directed_graph_node::add(Directed_graph_node* dep_l) +Directed_graph_node::add (Directed_graph_node* dep_l) { PARANOID_OK(); if (!dep_l) return ; - dep_l->edge_in_l_arr_.push(this); - edge_out_l_arr_.push(dep_l); + dep_l->edge_in_l_arr_.push (this); + edge_out_l_arr_.push (dep_l); PARANOID_OK(); } diff --git a/flower/dstream.cc b/flower/dstream.cc index ce0a51d363..f6d1d48867 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -21,40 +21,40 @@ const INDTAB = 2; should use Regexp library. */ static String -strip_pretty(String pretty_str) +strip_pretty (String pretty_str) { - int i = pretty_str.index_i('('); + int i = pretty_str.index_i ('('); if (i>=0) - pretty_str = pretty_str.left_str(i); + pretty_str = pretty_str.left_str (i); - int l = pretty_str.index_last_i(' '); // strip until last ' ' + int l = pretty_str.index_last_i (' '); // strip until last ' ' if (l>=0) - pretty_str = pretty_str.nomid_str(0,l+1); + pretty_str = pretty_str.nomid_str (0,l+1); return pretty_str; } static String -strip_member(String pret) +strip_member (String pret) { - int l=pret.index_last_i(':')-1; + int l=pret.index_last_i (':')-1; if (l>=0) - pret = pret.left_str(l ); + pret = pret.left_str (l); return pret; } Dstream& -Dstream::identify_as(String name) +Dstream::identify_as (String name) { if (!os_l_) return *this; - String mem(strip_pretty(name)); - String cl(strip_member(mem)); + String mem (strip_pretty (name)); + String cl (strip_member (mem)); String idx = cl; - if (silent_assoc_p_->elt_b(mem)) + if (silent_assoc_p_->elt_b (mem)) idx = mem; - else if (silent_assoc_p_->elt_b(cl)) + else if (silent_assoc_p_->elt_b (cl)) idx = cl; else { (*silent_assoc_p_)[idx] = false; @@ -69,9 +69,9 @@ Dstream::identify_as(String name) } bool -Dstream::silence(String s) +Dstream::silence (String s) { - if (!silent_assoc_p_->elt_b(s)) + if (!silent_assoc_p_->elt_b (s)) return false; return (*silent_assoc_p_)[s]; } @@ -79,32 +79,32 @@ Dstream::silence(String s) Dstream & Dstream::operator<<(String s) { - output(s); + output (s); return *this; } Dstream & Dstream::operator<<(void const *v_l) { - output(String_convert::pointer_str(v_l)); + output (String_convert::pointer_str (v_l)); return *this; } Dstream & Dstream::operator<<(char const *ch_l) { - output(ch_l); + output (ch_l); return *this; } void -Dstream::output(String s) +Dstream::output (String s) { if (local_silence_b_|| !os_l_) return ; for (char const *cp = s ; *cp; cp++) - switch(*cp) { + switch (*cp) { case '{': case '[': case '(': indent_level_i_ += INDTAB; @@ -131,7 +131,7 @@ Dstream::output(String s) } -Dstream::Dstream(ostream *r, char const * cfg_nm ) +Dstream::Dstream (ostream *r, char const * cfg_nm) { os_l_ = r; silent_assoc_p_ = new Assoc; @@ -141,19 +141,19 @@ Dstream::Dstream(ostream *r, char const * cfg_nm ) char const * fn =cfg_nm ? cfg_nm : ".dstreamrc"; { - ifstream ifs(fn); // can't open + ifstream ifs (fn); // can't open if (!ifs) return; } - Text_db cfg(fn); + Text_db cfg (fn); while (! cfg.eof()){ - Text_record r( cfg++); + Text_record r (cfg++); if (r.size() != 2) { - r.message("not enough fields in Dstream init."); + r.message ("not enough fields in Dstream init."); continue; } - (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar(r[1])); + (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1])); } } @@ -162,13 +162,13 @@ Dstream::Dstream(ostream *r, char const * cfg_nm ) Dstream::~Dstream() { delete silent_assoc_p_; - assert(!indent_level_i_) ; + assert (!indent_level_i_) ; } void Dstream::clear_silence() { - for (Assoc_iter i(*silent_assoc_p_); i.ok(); i++) { + for (Assoc_iter i (*silent_assoc_p_); i.ok(); i++) { i.val() = 0; } } diff --git a/flower/flower-version.cc b/flower/flower-version.cc index fd37845588..84cfd803d3 100644 --- a/flower/flower-version.cc +++ b/flower/flower-version.cc @@ -11,6 +11,6 @@ char const * flower_version_sz() { static char v[1024]; - sprintf(v, s, build); + sprintf (v, s, build); return v; } diff --git a/flower/full-storage.cc b/flower/full-storage.cc index fd0d9f550b..34dcdad1b8 100644 --- a/flower/full-storage.cc +++ b/flower/full-storage.cc @@ -12,7 +12,7 @@ void Full_storage::operator=(Full_storage const &fs) { - resize(fs.height_i_, fs.width_i_); + resize (fs.height_i_, fs.width_i_); OK(); fs.OK(); for (int i=0; i= height_i_ && max_width_i_ >= width_i_); - assert(height_i_ >= 0 && width_i_ >= 0); - assert(els_p_p_||!max_height_i_); + assert (max_height_i_ >= height_i_ && max_width_i_ >= width_i_); + assert (height_i_ >= 0 && width_i_ >= 0); + assert (els_p_p_||!max_height_i_); #endif } @@ -44,24 +44,24 @@ Full_storage::~Full_storage() void -Full_storage::resize(int rows, int cols) +Full_storage::resize (int rows, int cols) { OK(); - resize_cols(rows); - resize_rows(cols); + resize_cols (rows); + resize_rows (cols); } bool -Full_storage::mult_ok(int i, int ) const +Full_storage::mult_ok (int i, int) const { return i < height_i_; } bool -Full_storage::trans_ok(int , int j) const +Full_storage::trans_ok (int , int j) const { return j < width_i_; } @@ -69,9 +69,9 @@ Full_storage::trans_ok(int , int j) const void -Full_storage::trans_next(int &i, int &j) const +Full_storage::trans_next (int &i, int &j) const { - assert(trans_ok(i,j)); + assert (trans_ok (i,j)); i++; if (i >= height_i_) { i=0; @@ -81,9 +81,9 @@ Full_storage::trans_next(int &i, int &j) const void -Full_storage::mult_next(int &i, int &j) const +Full_storage::mult_next (int &i, int &j) const { - assert(mult_ok(i,j)); + assert (mult_ok (i,j)); j++; if (j >= width_i_) { j=0; @@ -93,9 +93,9 @@ Full_storage::mult_next(int &i, int &j) const void -Full_storage::delete_column(int k) +Full_storage::delete_column (int k) { - assert(0 <= k &&k k ; i--) for (int j=0; j name() != Full_storage::static_name() || - right->name() != Full_storage::static_name()) + if (dest->name() != Full_storage::static_name () || + right->name() != Full_storage::static_name ()) return false; Full_storage *d_l = (Full_storage*)dest; Full_storage *r_l = (Full_storage*)right; - d_l->set_size(height_i_, r_l->width_i_); + d_l->set_size (height_i_, r_l->width_i_); for (int i=0; i < d_l->height_i_; i++) for (int j = 0; j < d_l->width_i_; j++) { - Real &r(d_l->els_p_p_[i][j]); + Real &r (d_l->els_p_p_[i][j]); r=0.0; for (int k = 0; k < width_i_; k++) r += els_p_p_[i][k] * r_l->els_p_p_[k][j]; @@ -151,7 +151,7 @@ Full_storage::try_right_multiply(Matrix_storage * dest, Matrix_storage const * r } IMPLEMENT_IS_TYPE_B1(Full_storage,Matrix_storage); void -Full_storage::resize_cols(int newh) +Full_storage::resize_cols (int newh) { if (newh <= max_height_i_) { height_i_=newh; @@ -172,20 +172,20 @@ Full_storage::resize_cols(int newh) -Full_storage::Full_storage(Matrix_storage*m) +Full_storage::Full_storage (Matrix_storage*m) { - set_size(m->rows(), m->cols()); + set_size (m->rows(), m->cols ()); if ( !m->is_type_b ( Full_storage::static_name())) for (int i=0; imult_ok(i,j); m->mult_next(i,j)) - els_p_p_[i][j] = m->elem(i,j); + for (int i,j=0; m->mult_ok (i,j); m->mult_next (i,j)) + els_p_p_[i][j] = m->elem (i,j); } void -Full_storage::resize_rows(int neww) +Full_storage::resize_rows (int neww) { if (neww <= max_width_i_) { width_i_=neww; diff --git a/flower/include/acursor.hh b/flower/include/acursor.hh index 3664b8245f..51ae3ea4d2 100644 --- a/flower/include/acursor.hh +++ b/flower/include/acursor.hh @@ -17,12 +17,12 @@ protected: int idx_; Array &arr_; public: - ACursor(ACursor const& s) + ACursor (ACursor const& s) :arr_(s.arr_) { idx_ = s.idx_; } - ACursor(Array const &arr) + ACursor (Array const &arr) arr_((Array&)arr) { idx_ =0; @@ -36,7 +36,7 @@ public: idx_ ++; return t; } - bool ok() { return idx_ >=0 && idx_ < arr_.size(); } + bool ok() { return idx_ >=0 && idx_ < arr_.size (); } }; @@ -44,8 +44,8 @@ template class PACursor : public ACursor { public: - PACursor(Link_array l) - : ACursor(l) + PACursor (Link_array l) + : ACursor (l) { } T* ptr() { return arr_[idx_]; } diff --git a/flower/include/assoc-iter.hh b/flower/include/assoc-iter.hh index 34b88df22d..9157ad0ab7 100644 --- a/flower/include/assoc-iter.hh +++ b/flower/include/assoc-iter.hh @@ -15,12 +15,12 @@ struct Assoc_iter { int i; Assoc &assoc_; /// we don't want to be bothered by const correctness - Assoc_iter(const Assoc &a) : + Assoc_iter (const Assoc &a) : assoc_((Assoc &)a) { - i= next(0); + i= next (0); } - int next(int j) { + int next (int j) { while (j < assoc_.arr.size() && assoc_.arr[j].free) j++; return j; @@ -29,9 +29,9 @@ struct Assoc_iter { return i < assoc_.arr.size(); } void OK()const { - assert(!ok() || !assoc_.arr[i].free); + assert (!ok() || !assoc_.arr[i].free); } - void operator++(int) { i++; i = next(i); } + void operator++(int) { i++; i = next (i); } K key() { return assoc_.arr[i].key; } V &val() { return assoc_.arr[i].val; } }; diff --git a/flower/include/assoc.hh b/flower/include/assoc.hh index 0d9cbc9a43..92a7c8ee10 100644 --- a/flower/include/assoc.hh +++ b/flower/include/assoc.hh @@ -26,19 +26,19 @@ struct Assoc { /* ************** */ - int find(K key) const { + int find (K key) const { for (int i = 0; i < arr.size(); i++) { if (!arr[i].free && key == arr[i].key) return i; } return -1; } - int find_creat(K key) { + int find_creat (K key) { int free = -1; for (int i = 0; i < arr.size(); i++) { if (key == arr[i].key) { return i; - } else if (arr[i].free ) { + } else if (arr[i].free) { free = i; } } @@ -51,35 +51,35 @@ struct Assoc { Assoc_ent_ ae; ae.free = false; ae.key = key; - arr.push(ae); + arr.push (ae); return arr.size() -1; } public: - bool elt_b(K key) const { - return find(key) >= 0; + bool elt_b (K key) const { + return find (key) >= 0; } - void del(K key) { - assert(elt_b(key)); - int i= find(key); + void del (K key) { + assert (elt_b (key)); + int i= find (key); arr[i].free = true; } void - add(K key, V val) { - int i = find_creat(key); + add (K key, V val) { + int i = find_creat (key); arr[i].val = val; } - V& elem(K key) { - return arr[find_creat(key)].val; + V& elem (K key) { + return arr[find_creat (key)].val; } V& operator[](K key) { - return elem(key); + return elem (key); } V const & operator[](K key) const { - return elem(key); + return elem (key); } - V const & elem(K key) const { - assert(elt_b(key)); - return arr[find(key)].val; + V const & elem (K key) const { + assert (elt_b (key)); + return arr[find (key)].val; } }; diff --git a/flower/include/choleski.hh b/flower/include/choleski.hh index abd19ee676..dd21237550 100644 --- a/flower/include/choleski.hh +++ b/flower/include/choleski.hh @@ -9,7 +9,7 @@ #P# is split into - LD transpose(L) + LD transpose (L) */ struct Choleski_decomposition { @@ -24,12 +24,12 @@ struct Choleski_decomposition { P needs to be symmetric positive definite */ - Choleski_decomposition(Matrix const &P); + Choleski_decomposition (Matrix const &P); /** solve Px = rhs */ - Vector solve(Vector rhs) const; + Vector solve (Vector rhs) const; void solve (Vector &dest, Vector const &rhs)const; Vector operator * (Vector rhs) const { return solve (rhs); } /** @@ -41,10 +41,10 @@ struct Choleski_decomposition { */ Matrix original() const; private: - void full_matrix_solve(Vector &,Vector const&)const; - void band_matrix_solve(Vector &, Vector const&)const; - void full_matrix_decompose(Matrix const & P); - void band_matrix_decompose(Matrix const &P); + void full_matrix_solve (Vector &,Vector const&)const; + void band_matrix_solve (Vector &, Vector const&)const; + void full_matrix_decompose (Matrix const & P); + void band_matrix_decompose (Matrix const &P); }; #endif diff --git a/flower/include/compare.hh b/flower/include/compare.hh index 203ba014e7..ef69ce5162 100644 --- a/flower/include/compare.hh +++ b/flower/include/compare.hh @@ -6,48 +6,48 @@ #ifndef COMPARE_HH #define COMPARE_HH -#define one_operator(type, function, op) \ +#define ONE_OPERATOR(type, function, op) \ inline bool \ operator op (type t1, type t2) {\ - return function(t1, t2) op 0;\ + return function (t1, t2) op 0;\ }\ -#define gpp_minmax_operator(type, op, opp) \ +#define GPP_MINMAX_OPERATOR(type, op, opp) \ inline type \ -operator op(type t1, type t2)\ +operator op (type t1, type t2)\ {\ return (t1 opp t2) ? t1 : t2;\ }\ #if defined (__GNUG__) && ! defined (__STRICT_ANSI__) -#define gpp_minmax(type, prefix)\ - prefix gpp_minmax_operator(type, ?, >) +#define GPP_MINMAX(type, prefix)\ + prefix GPP_MINMAX_OPERATOR(type, ?, >) #else -#define gpp_minmax(type, prefix) +#define GPP_MINMAX(type, prefix) #endif /** handy notations for a signed comparison. make the operators{<,<=,==,>=,>} and the MAX and MIN of two. Please fill a & in the type argument if necessary. */ -#define template_instantiate_compare(type, function, prefix) \ -prefix one_operator(type, function, >)\ -prefix one_operator(type, function, >=)\ -prefix one_operator(type, function, ==)\ -prefix one_operator(type, function, !=)\ -prefix one_operator(type, function, <)\ -prefix one_operator(type, function, <=)\ -gpp_minmax(type, prefix)\ -prefix inline type max(type t1, type t2) { return (t1 > t2 )? t1 : t2; }\ -prefix inline type min(type t1, type t2) { return (t1 < t2 )? t1 : t2; }\ +#define TEMPLATE_INSTANTIATE_COMPARE(type, function, prefix) \ +prefix ONE_OPERATOR(type, function, >)\ +prefix ONE_OPERATOR(type, function, >=)\ +prefix ONE_OPERATOR(type, function, ==)\ +prefix ONE_OPERATOR(type, function, !=)\ +prefix ONE_OPERATOR(type, function, <)\ +prefix ONE_OPERATOR(type, function, <=)\ +GPP_MINMAX(type, prefix)\ +prefix inline type max (type t1, type t2) { return (t1 > t2)? t1 : t2; }\ +prefix inline type min (type t1, type t2) { return (t1 < t2)? t1 : t2; }\ \ prefix bool operator<(type t1, type t2) /* stupid fix to allow ; */ -#define instantiate_compare(type, func) template_instantiate_compare(type,func, ) +#define INSTANTIATE_COMPARE(type, func) TEMPLATE_INSTANTIATE_COMPARE(type,func,) diff --git a/flower/include/cursor.hh b/flower/include/cursor.hh index 05a3e897c4..2e205ba330 100644 --- a/flower/include/cursor.hh +++ b/flower/include/cursor.hh @@ -20,19 +20,19 @@ class Cursor public: /** create cursor, set at top. The const part isn't true, actually, #list# surely isn't const, but I get tired of the warning messages. */ - Cursor( const List& list, Link* pointer = 0 ); + Cursor (const List& list, Link* pointer = 0); /** Create an invalid cursor (pointing to nothing, associated with no list.) */ Cursor(); - Cursor( const Cursor& cursor ); + Cursor (const Cursor& cursor); T& thing(); /// return current T T& operator *() { return thing(); } operator T() { return thing(); } - Cursor operator =( const Cursor& c ); + Cursor operator =( const Cursor& c); /// make cursor with #no# items back Cursor operator -( int no) const; @@ -47,10 +47,10 @@ class Cursor /// move one up. void previous(); /// return current and move one down - Cursor operator ++( int ); + Cursor operator ++( int); /// return current and move one up - Cursor operator --( int ); + Cursor operator --( int); /// point to link? bool ok()const; @@ -72,7 +72,7 @@ class Cursor cursor points to same object, cursor.next() is newly added object. */ - void add( T const & thing ); + void add (T const & thing); /** put (copy) before me in List. analogously to editor. ok() interpreted as at begin of @@ -86,7 +86,7 @@ class Cursor is newly inserted object. */ - void insert( T const & thing ); + void insert (T const & thing); /// void backspace(); @@ -96,7 +96,7 @@ class Cursor /// access the list this came from List& list() const ; Link* pointer(); - static int compare(Cursor a,Cursorb) { return a-b; } + static int compare (Cursor a,Cursorb) { return a-b; } private: List& list_; Link* pointer_; @@ -109,7 +109,7 @@ private: #include "compare.hh" -template_instantiate_compare(Cursor, Cursor::compare, template); +TEMPLATE_INSTANTIATE_COMPARE(Cursor, Cursor::compare, template); #include "pcursor.hh" #include "list.hh" diff --git a/flower/include/cursor.icc b/flower/include/cursor.icc index 6a2ae6c538..d0b2439af4 100644 --- a/flower/include/cursor.icc +++ b/flower/include/cursor.icc @@ -17,7 +17,7 @@ // untested template inline -Cursor::Cursor( ) +Cursor::Cursor() : list_(*(List *)0) // ugh { pointer_ = 0; @@ -26,10 +26,10 @@ Cursor::Cursor( ) template inline -Cursor::Cursor( const List& list, Link* pointer ) : - list_((List&) list ) +Cursor::Cursor (const List& list, Link* pointer) : + list_((List&) list) { - if ( list.size() ) + if ( list.size()) pointer_ = pointer ? pointer : list.top_; else pointer_ = pointer; @@ -37,8 +37,8 @@ Cursor::Cursor( const List& list, Link* pointer ) : template inline -Cursor::Cursor( const Cursor& cursor ) : - list_( cursor.list_ ) +Cursor::Cursor (const Cursor& cursor) : + list_( cursor.list_) { pointer_ = cursor.pointer_; } @@ -47,31 +47,31 @@ template inline T& Cursor::thing() { - assert( pointer_ ); + assert (pointer_); return pointer_->thing(); } template Cursor -Cursor::operator =( const Cursor& c ) +Cursor::operator =( const Cursor& c) { - assert( &list_ == &c.list_ ); + assert (&list_ == &c.list_); pointer_ = c.pointer_; return *this; } template inline void -Cursor::add( const T& th ) +Cursor::add (const T& th) { - list_.add( th, *this ); + list_.add (th, *this); } template inline void -Cursor::insert( const T& th ) +Cursor::insert (const T& th) { - list_.insert( th, *this ); + list_.insert (th, *this); } template @@ -92,33 +92,33 @@ template inline bool Cursor::backward()const { - return ( pointer_ != 0 ); + return ( pointer_ != 0); } template inline bool Cursor::forward()const { - return ( pointer_ != 0 ); + return ( pointer_ != 0); } template inline bool Cursor::ok()const { - return ( pointer_ != 0 ); + return ( pointer_ != 0); } template inline void Cursor::next() { - assert( pointer_ ); + assert (pointer_); pointer_ = pointer_->next(); } template inline Cursor -Cursor::operator ++( int ) +Cursor::operator ++( int) { Cursor r (*this); next(); @@ -129,13 +129,13 @@ template inline void Cursor::previous() { - assert( pointer_ ); + assert (pointer_); pointer_ = pointer_->previous(); } template inline Cursor -Cursor::operator --( int ) +Cursor::operator --( int) { Cursor r (*this); previous(); diff --git a/flower/include/cursor.tcc b/flower/include/cursor.tcc index 3be73fe5d2..18f1fbb42a 100644 --- a/flower/include/cursor.tcc +++ b/flower/include/cursor.tcc @@ -8,27 +8,27 @@ template void Cursor::backspace() { - Cursor c(*this); - if ( c.ok() ) + Cursor c (*this); + if ( c.ok()) c--; - list_.remove( *this ); + list_.remove (*this); } template void Cursor::del() { - Cursor c(*this); - if ( c.ok() ) + Cursor c (*this); + if ( c.ok()) c++; - list_.remove( *this ); + list_.remove (*this); *this = c; } template Cursor -Cursor::operator -=( int j ) +Cursor::operator -=( int j) { while (j--) (*this)--; @@ -36,7 +36,7 @@ Cursor::operator -=( int j ) } template Cursor -Cursor::operator +=( int j ) +Cursor::operator +=( int j) { while (j++) (*this)++; @@ -45,7 +45,7 @@ Cursor::operator +=( int j ) template Cursor -Cursor::operator +( int i ) const +Cursor::operator +( int i) const { Cursor r = *this; @@ -60,7 +60,7 @@ Cursor::operator +( int i ) const template Cursor -Cursor::operator -( int i ) const +Cursor::operator -( int i) const { Cursor r = *this; if (i<0) @@ -79,11 +79,11 @@ template int Cursor::operator-(Cursor rhs) const { - assert(rhs.list == list); + assert (rhs.list == list); int dif = 0; // search from *this on further up (positive difference) - Cursor c(*this); + Cursor c (*this); while (c.ok() && c.pointer_ != rhs.pointer_) { c--; dif++; @@ -99,10 +99,10 @@ Cursor::operator-(Cursor rhs) const dif --; c++; } - assert(c.ok()); + assert (c.ok()); gotcha: - assert((*this - dif).pointer_ == c.pointer_); + assert ((*this - dif).pointer_ == c.pointer_); return dif; } diff --git a/flower/include/data-file.hh b/flower/include/data-file.hh index dae9e56347..fa75f69922 100644 --- a/flower/include/data-file.hh +++ b/flower/include/data-file.hh @@ -24,8 +24,8 @@ class Data_file : private Text_stream Text_stream::get_name; char data_get(); - void data_unget(char c) { - unget(c); + void data_unget (char c) { + unget (c); } /// read line, eat #\n# @@ -39,7 +39,7 @@ class Data_file : private Text_stream /// gobble empty stuff before first field. void gobble_leading_white(); - Data_file(String s) : Text_stream(s) { + Data_file (String s) : Text_stream (s) { //*mlog << "(" << s << flush; rawmode= false; } @@ -48,12 +48,12 @@ class Data_file : private Text_stream // *mlog << ")"< *silent_assoc_p_; public: void clear_silence(); - bool silence(String); + bool silence (String); /** if rcfile == 0, then do not read any rc file. */ - Dstream(ostream *r, char const * rcfile); + Dstream (ostream *r, char const * rcfile); virtual ~Dstream(); - Dstream &identify_as(String s); + Dstream &identify_as (String s); /** Output a string via the Dstream. This is the only output interface. It delegates all conversion to String class. */ diff --git a/flower/include/flower-debug.hh b/flower/include/flower-debug.hh index a617c6f379..de19d30630 100644 --- a/flower/include/flower-debug.hh +++ b/flower/include/flower-debug.hh @@ -15,11 +15,11 @@ extern Dstream *flower_dstream; extern bool flower_check_debug; #ifdef NPRINT -#define fdebug if ( 0 ) *flower_dstream +#define fdebug if ( 0) *flower_dstream #else #define fdebug if (flower_check_debug) \ - flower_dstream->identify_as(__PRETTY_FUNCTION__) + flower_dstream->identify_as (__PRETTY_FUNCTION__) #endif -void set_flower_debug(Dstream&ds, bool); +void set_flower_debug (Dstream&ds, bool); #endif // FLOWER_DEBUG_HH diff --git a/flower/include/full-storage.hh b/flower/include/full-storage.hh index 1dfb96e8fa..0d17df412f 100644 --- a/flower/include/full-storage.hh +++ b/flower/include/full-storage.hh @@ -28,41 +28,41 @@ class Full_storage : public Matrix_storage void init() ; - bool valid(int i, int j) const ; + bool valid (int i, int j) const ; - void resize_rows(int); - void resize_cols(int); + void resize_rows (int); + void resize_cols (int); public: virtual int rows() const; virtual int cols() const ; - virtual void resize(int i, int j); - virtual void resize(int i); - virtual Real& elem(int i,int j); - virtual Real elem(int i, int j)const ; + virtual void resize (int i, int j); + virtual void resize (int i); + virtual Real& elem (int i,int j); + virtual Real elem (int i, int j)const ; int dim()const; - Full_storage(Matrix_storage*); + Full_storage (Matrix_storage*); Full_storage(); - Full_storage(int i, int j); - Full_storage(Full_storage const&); - Full_storage(int i); + Full_storage (int i, int j); + Full_storage (Full_storage const&); + Full_storage (int i); void OK() const; void operator=(Full_storage const &); - virtual void insert_row(int k); - virtual void delete_row(int k); - virtual void delete_column(int k); + virtual void insert_row (int k); + virtual void delete_row (int k); + virtual void delete_column (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; + 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; DECLARE_VIRTUAL_COPY_CONS(Full_storage,Matrix_storage); DECLARE_MY_RUNTIME_TYPEINFO; - virtual bool try_right_multiply(Matrix_storage * dest, Matrix_storage const * )const; + virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *)const; }; #endif // FULL_STORAGE_HH diff --git a/flower/include/full-storage.icc b/flower/include/full-storage.icc index 06bcc9d70c..d71dbe07e7 100644 --- a/flower/include/full-storage.icc +++ b/flower/include/full-storage.icc @@ -18,7 +18,7 @@ Full_storage::init() height_i_=width_i_=max_height_i_=max_width_i_=0; } INLINE bool -Full_storage::valid(int i, int j)const +Full_storage::valid (int i, int j)const { return (i>=0 && i < height_i_) && (j < width_i_ && j >=0); @@ -26,22 +26,22 @@ Full_storage::valid(int i, int j)const INLINE -Full_storage::Full_storage(Full_storage const&s) +Full_storage::Full_storage (Full_storage const&s) { init(); (*this) = s; } INLINE Real& -Full_storage::elem(int i,int j) +Full_storage::elem (int i,int j) { - assert(valid(i,j)); + assert (valid (i,j)); return els_p_p_[i][j]; } INLINE Real -Full_storage::elem(int i, int j) const { - assert(valid(i,j)); +Full_storage::elem (int i, int j) const { + assert (valid (i,j)); return els_p_p_[i][j]; } @@ -64,28 +64,28 @@ Full_storage::cols() const INLINE int Full_storage::dim()const { - assert (rows()==cols()); + assert (rows()==cols ()); return rows(); } INLINE void -Full_storage::resize(int i) +Full_storage::resize (int i) { - resize(i,i); + resize (i,i); } INLINE -Full_storage::Full_storage(int i,int j) +Full_storage::Full_storage (int i,int j) { init(); - set_size(i,j); + set_size (i,j); } INLINE -Full_storage::Full_storage(int i) +Full_storage::Full_storage (int i) { init(); - set_size(i); + set_size (i); } INLINE diff --git a/flower/include/handle.hh b/flower/include/handle.hh index 26328bd26b..4176325b15 100644 --- a/flower/include/handle.hh +++ b/flower/include/handle.hh @@ -17,7 +17,7 @@ class Handle { refs = 0; } /// point to new object. - void up(T *t, int *r) { + void up (T *t, int *r) { if (!r) { refs = new int; *refs = 1; @@ -29,23 +29,23 @@ class Handle { } /// POST: *refs == 1 void copy() { - if(*refs != 1){ - T * newobj = new T(*obj ); + if (*refs != 1){ + T * newobj = new T(*obj); down(); - up(newobj); + up (newobj); } } - Handle(Handle const &src) { - up(src.obj, src.refs); + Handle (Handle const &src) { + up (src.obj, src.refs); } - Handle(T & o) { + Handle (T & o) { up (&o); } void operator=(Handle const& src) { if (this == &src) return; down(); - up(src.o, src.refs); + up (src.o, src.refs); } operator T const &() { return *obj; diff --git a/flower/include/iterate.hh b/flower/include/iterate.hh index 74e6ff202c..65b092d1d5 100644 --- a/flower/include/iterate.hh +++ b/flower/include/iterate.hh @@ -18,13 +18,13 @@ (it does save quite some disk space, though) */ -#define iterator(set) typeof((set).top()) -#define iterator_bot(set) typeof((set).bottom()) +#define iterator(set) typeof ((set).top()) +#define iterator_bot(set) typeof ((set).bottom()) -#define iter(init, var) typeof(init) var(init) +#define iter(init, var) typeof (init) var (init) // should use top() -#define iter_top(set,var) iterator(set) var(set) -#define iter_bot(set,var) iterator(set) var(set.bottom()) +#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/include/lgetopt.hh b/flower/include/lgetopt.hh index 89b0196bf2..b8a2e19049 100644 --- a/flower/include/lgetopt.hh +++ b/flower/include/lgetopt.hh @@ -14,7 +14,7 @@ struct Long_option_init { char const * longname; char shortname; - void printon(ostream &errorout)const ; + void printon (ostream &errorout)const ; }; @@ -72,7 +72,7 @@ public: bool ok() const; /// report an error and abort - void report(Errorcod c); + void report (Errorcod c); /// return an integer (with err. detect) @@ -85,10 +85,10 @@ public: if #os# is null, then do not report nor abort, just set #error# */ - void seterror(ostream *os); + void seterror (ostream *os); /// construct: pass arguments and option info. - Getopt_long(int c, char **v, Long_option_init *lo); + Getopt_long (int c, char **v, Long_option_init *lo); /** get the next option. @return pointer to next option found. diff --git a/flower/include/libc-extension.hh b/flower/include/libc-extension.hh index 96f3df00e1..3f94a03a0e 100644 --- a/flower/include/libc-extension.hh +++ b/flower/include/libc-extension.hh @@ -12,22 +12,22 @@ #include "fproto.hh" #include "config.hh" -char* strnlwr( char* start_l ,int n); -char* strnupr( char* start_l, int n); +char* strnlwr (char* start_l ,int n); +char* strnupr (char* start_l, int n); #if !HAVE_MEMMEM // GNU extension. -char *memmem(Byte const * haystack, int haystack_len, +char *memmem (Byte const * haystack, int haystack_len, Byte const *needle, int needle_len); #endif HAVE_MEMMEM #if !HAVE_SNPRINTF // GNU extension. int snprintf (char *str, size_t n, - char const *format, ... ); + char const *format, ...); #endif -Byte *memrchr(Byte const * p, int n, char c); -Byte *strrev( Byte* byte_l, int length_i ); +Byte *memrchr (Byte const * p, int n, char c); +Byte *strrev (Byte* byte_l, int length_i); #endif // LIBC_EXTENSION_HH diff --git a/flower/include/link.hh b/flower/include/link.hh index 218a0f8e55..5fce0ac915 100644 --- a/flower/include/link.hh +++ b/flower/include/link.hh @@ -12,21 +12,21 @@ class Link { // friend class Cursor; public: - Link( T const & thing ); + Link (T const & thing); Link* previous(); Link* next(); /// put new Link item after me in list - void add( T const & thing ); + void add (T const & thing); /// put new Link item before me in list - void insert( T const & thing ); - void remove(List &l); + void insert (T const & thing); + void remove (List &l); T& thing(); void OK() const; private: - Link( Link* previous, Link* next, T const & thing ); + Link (Link* previous, Link* next, T const & thing); T thing_; Link* previous_; diff --git a/flower/include/link.icc b/flower/include/link.icc index 3926d6bc2a..68b87a73fc 100644 --- a/flower/include/link.icc +++ b/flower/include/link.icc @@ -9,26 +9,26 @@ Link::OK() const { #ifndef NDEBUG if (previous_) { - assert(previous_->next_ == this); + assert (previous_->next_ == this); } if (next_) { - assert(next_->previous_ == this); + assert (next_->previous_ == this); } #endif } template inline -Link::Link( const T& thing ) : - thing_( thing ) +Link::Link (const T& thing) : + thing_( thing) { previous_ = next_ = 0; } template inline -Link::Link( Link* previous, Link* next, const T& thing ) : - thing_( thing ) +Link::Link (Link* previous, Link* next, const T& thing) : + thing_( thing) { previous_ = previous; next_ = next; @@ -53,23 +53,23 @@ Link::previous() template inline void -Link::add( const T& thing ) +Link::add (const T& thing) { - Link* l = new Link( this, next_, thing ); - if ( next_ ) + Link* l = new Link( this, next_, thing); + if ( next_) next_->previous_ = l; next_ = l; } template inline void -Link::insert( const T& thing ) +Link::insert (const T& thing) { - // Link* l = new Link( next_, this, thing ); + // Link* l = new Link( next_, this, thing); // bugfix hwn 16/9/96 - Link* l = new Link( previous_, this, thing ); - if ( previous_ ) + Link* l = new Link( previous_, this, thing); + if ( previous_) previous_->next_ = l; previous_ = l; } @@ -79,14 +79,14 @@ Link::insert( const T& thing ) */ template inline void -Link::remove(List &l) +Link::remove (List &l) { - if ( previous_ ) + if ( previous_) previous_->next_ = next_; else l.top_ = next_; - if ( next_ ) + if ( next_) next_->previous_ = previous_; else l.bottom_ = previous_; diff --git a/flower/include/list.hh b/flower/include/list.hh index fcc5e70712..f1ddb48e69 100644 --- a/flower/include/list.hh +++ b/flower/include/list.hh @@ -19,8 +19,8 @@ template class Link; {\bf note:} retrieving "invalid" cursors, i.e. - #top()/bottom()# from empty list, #find()# without success, - results in a nonvalid Cursor ( #!ok()# ) + #top()/bottom ()# from empty list, #find ()# without success, + results in a nonvalid Cursor ( #!ok()#) INVARIANTEN! @@ -30,7 +30,7 @@ template class List { public: - List(List const&src); + List (List const&src); /// construct empty list List(); @@ -48,7 +48,7 @@ class List friend class Cursor; friend class Link; - void concatenate(List const &s); + void concatenate (List const &s); /** make *this empty. @@ -60,10 +60,10 @@ class List */ void set_empty(); - void add( T const & thing, Cursor &after_me ); + void add (T const & thing, Cursor &after_me); /// put thing before #before_me# - void insert( T const & thing, Cursor &before_me ); + void insert (T const & thing, Cursor &before_me); /** Remove link pointed to by me. Destructor of contents called (nop for pointers) @@ -74,7 +74,7 @@ class List WARNING: do not use #me# after calling */ - void remove( Cursor me ); + void remove (Cursor me); /* ************** */ diff --git a/flower/include/list.icc b/flower/include/list.icc index df0687b7c8..83ec3aa796 100644 --- a/flower/include/list.icc +++ b/flower/include/list.icc @@ -20,11 +20,11 @@ List::set_empty() template inline void -List::remove( Cursor me ) +List::remove (Cursor me) { - if ( me.ok() ){ + if ( me.ok()){ Link *lp = me.pointer(); - lp->remove(*this); + lp->remove (*this); delete lp; size_--; } @@ -41,7 +41,7 @@ template inline Cursor List::top()const { - return Cursor( *this, top_ ); + return Cursor( *this, top_); } @@ -49,7 +49,7 @@ template inline Cursor List::bottom()const { - return Cursor( *this, bottom_ ); + return Cursor( *this, bottom_); } diff --git a/flower/include/matrix-storage.hh b/flower/include/matrix-storage.hh index a5971b2688..662cdddc89 100644 --- a/flower/include/matrix-storage.hh +++ b/flower/include/matrix-storage.hh @@ -47,14 +47,14 @@ public: PRE i >=0, j>=0 */ - virtual void set_size(int rows, int cols) ; + virtual void set_size (int rows, int cols) ; /**set the size to square dimen. contents lost PRE i>=0 */ - virtual void set_size(int i) ; + virtual void set_size (int i) ; /**set the size to i. keep contents. If enlarged contents unspecified @@ -63,7 +63,7 @@ public: i>=0, j>=0 */ - virtual void resize(int rows, int cols ) = 0; + virtual void resize (int rows, int cols) = 0; /** set the size to square dimen. contents kept @@ -72,7 +72,7 @@ public: PRE i>=0 */ - virtual void resize(int i) = 0; + virtual void resize (int i) = 0; /** @@ -82,13 +82,13 @@ public: in the 0-part of a sparse matrix. */ - virtual Real& elem(int i,int j) = 0; + virtual Real& elem (int i,int j) = 0; /// access a element, no modify - virtual Real elem(int i, int j) const = 0; + virtual Real elem (int i, int j) const = 0; - virtual Array row(int i) const ; - virtual Array column(int j) const; + virtual Array row (int i) const ; + virtual Array column (int j) const; /** @@ -97,7 +97,7 @@ public: 0 <= k <= rows() */ - virtual void insert_row(int k)=0; + virtual void insert_row (int k)=0; /** @@ -106,8 +106,8 @@ public: PRE 0 <= k < rows(); */ - virtual void delete_row(int k)=0; - virtual void delete_column(int k)=0; + virtual void delete_row (int k)=0; + virtual void delete_column (int k)=0; virtual ~Matrix_storage() { } virtual Matrix_storage *clone()const=0; @@ -116,12 +116,12 @@ public: /** at end of matrix?. when doing loop - for(i=0; iOK(); } - int cols() const { return dat->cols(); } - int rows() const { return dat->rows(); } + int cols() const { return dat->cols (); } + int rows() const { return dat->rows (); } /** return the size of a matrix. PRE @@ -54,14 +54,14 @@ public: ~Matrix() { delete dat; } /// set entries to r - void fill(Real r); + void fill (Real r); /// set diagonal to d - void set_diag(Real d); + void set_diag (Real d); - void set_diag(Vector d); + void set_diag (Vector d); /// set unit matrix - void unit() { set_diag(1.0); } + void unit() { set_diag (1.0); } void operator+=(Matrix const &m); void operator-=(Matrix const &m); @@ -72,48 +72,48 @@ public: add a row to the matrix before row k PRE - v.dim() == cols() + v.dim() == cols () 0 <= k <= rows() */ - void insert_row(Vector v,int k); + void insert_row (Vector v,int k); /** . delete a row from this matrix. PRE 0 <= k < rows(); */ - void delete_row(int k) { dat->delete_row(k); } - void delete_column(int k) { dat->delete_column(k); } + void delete_row (int k) { dat->delete_row (k); } + void delete_column (int k) { dat->delete_column (k); } /** square n matrix, initialised to null */ - Matrix(int n); + Matrix (int n); /** n x m matrix, init to 0 */ - Matrix(int n, int m); - Matrix(Matrix const &m); + Matrix (int n, int m); + Matrix (Matrix const &m); /// dyadic product: v * w.transpose - Matrix(Vector v, Vector w); + Matrix (Vector v, Vector w); void operator=(Matrix const &m); /// access an element - Real operator()(int i,int j) const { return dat->elem(i,j); } + Real operator()(int i,int j) const { return dat->elem (i,j); } /// access an element - Real &operator()(int i, int j) { return dat->elem(i,j); } + Real &operator()(int i, int j) { return dat->elem (i,j); } /// Matrix multiply with vec (from right) Vector operator *(Vector const &v) const; /// set this to m1*m2. - void set_product(Matrix const &m1, Matrix const &m2); + void set_product (Matrix const &m1, Matrix const &m2); - Vector left_multiply(Vector const &) const; + Vector left_multiply (Vector const &) const; Matrix operator-() const; @@ -128,24 +128,24 @@ public: PRE 0 <= c1,c2 < cols() */ - void swap_columns(int c1, int c2); + void swap_columns (int c1, int c2); /** swap. PRE 0 <= c1,c2 < rows() */ - void swap_rows(int c1, int c2); + void swap_rows (int c1, int c2); - Vector row(int ) const; - Vector col(int) const; + Vector row (int) const; + Vector col (int) const; operator String() const; void print() const; }; inline Vector -operator *(Vector &v, Matrix const & m) { return m.left_multiply(v); } +operator *(Vector &v, Matrix const & m) { return m.left_multiply (v); } Matrix operator *(Matrix const & m1,Matrix const &m2); Matrix operator /(Matrix const &m1,Real a); inline Matrix operator -(Matrix m1,const Matrix m2) diff --git a/flower/include/parray.hh b/flower/include/parray.hh index 61c69495c2..054288b809 100644 --- a/flower/include/parray.hh +++ b/flower/include/parray.hh @@ -21,7 +21,7 @@ template class Link_array : public Array { - static default_compare(T *const& p1, T *const&p2) { + static default_compare (T *const& p1, T *const&p2) { /* can't do p1 -p2, since T might be an incomplete type */ if (p1 < p2) return -1 ; @@ -30,48 +30,48 @@ class Link_array : public Array return 0; } public: - void substitute(T *old, T*new_l) + void substitute (T *old, T*new_l) { int i; - while ((i = find_i(old)) >=0) + while ((i = find_i (old)) >=0) if (new_l) - elem(i) =new_l; + elem (i) =new_l; else - del(i); + del (i); } - void unordered_substitute(T* old, T * new_l) + void unordered_substitute (T* old, T * new_l) { int i; - while ((i = find_i(old)) >=0) + while ((i = find_i (old)) >=0) if (new_l) - elem(i) =new_l; + elem (i) =new_l; else { - unordered_del( i ); + unordered_del (i); } } void default_sort() { - sort(default_compare); + sort (default_compare); } void uniq() { Link_array l_arr; for (int i=0; i < size(); i++) - if (!i || elem(i-1) != elem(i)) - l_arr.push(elem(i)); + if (!i || elem (i-1) != elem (i)) + l_arr.push (elem (i)); *this = l_arr; } int find_i (T const * t) const { for (int i=0; i < size(); i++) - if (elem(i) == t) + if (elem (i) == t) return i; return -1; } - T *find_l(T const *t)const + T *find_l (T const *t)const { - int i = find_i(t); + int i = find_i (t); if (i >= 0) - return elem(i); + return elem (i); else return 0; } diff --git a/flower/include/path.hh b/flower/include/path.hh index d41dc2ba1c..81a8cb1038 100644 --- a/flower/include/path.hh +++ b/flower/include/path.hh @@ -27,11 +27,11 @@ class File_path : private Array { public: /// locate a file in the search path - String find(String nm)const; + String find (String nm)const; /// add to end of path. Array::push; - void add(String str) { push(str); } + void add (String str) { push (str); } }; /** split a path into its components. @@ -41,6 +41,6 @@ public: @return String &drive, String &dirs, String &filebase, String &extension */ -void split_path(String path, String &drive, String &dirs, String &filebase, String &extension); +void split_path (String path, String &drive, String &dirs, String &filebase, String &extension); #endif diff --git a/flower/include/pcursor.hh b/flower/include/pcursor.hh index 6c9ceff0d7..5aa63d1d8f 100644 --- a/flower/include/pcursor.hh +++ b/flower/include/pcursor.hh @@ -34,38 +34,38 @@ public: return p; } T remove_prev_p() { - assert( ok() ); + assert (ok()); (*this)--; return remove_p(); } - Link_list &list() { return (Link_list&)Cursor::list(); } + Link_list &list() { return (Link_list&)Cursor::list (); } PCursor operator++(int) { return Cursor::operator++(0);} PCursor operator--(int) { return Cursor::operator--(0); } PCursor operator+=(int i) { return Cursor::operator+=(i);} PCursor operator-=(int i) { return Cursor::operator-=(i); } PCursor operator -(int no) const { return Cursor::operator-(no);} int operator -(PCursor op) const { return Cursor::operator-(op);} - PCursor operator +( int no) const {return Cursor::operator+(no);} PCursor(const Link_list & l) : Cursor (l) {} + PCursor operator +( int no) const {return Cursor::operator+(no);} PCursor (const Link_list & l) : Cursor (l) {} PCursor() : Cursor () {} - PCursor( const Cursor& cursor ) : Cursor(cursor) { } + PCursor (const Cursor& cursor) : Cursor(cursor) { } void* vptr() const { return *((Cursor &) *this); } // should return T& ? - T ptr() const { return (T) vptr(); } + T ptr() const { return (T) vptr (); } T operator ->() const { return ptr(); } operator T() { return ptr(); } T operator *() { return ptr(); } - void add(T const & p ) { Cursor::add((void*) p); } - void insert(T const & p ) { Cursor::insert((void*) p);} - static int compare(PCursor a,PCursorb) { - return Cursor::compare(a,b); + void add (T const & p) { Cursor::add ((void*) p); } + void insert (T const & p) { Cursor::insert ((void*) p);} + static int compare (PCursor a,PCursorb) { + return Cursor::compare (a,b); } }; #include "compare.hh" -template_instantiate_compare(PCursor, PCursor::compare, template); +TEMPLATE_INSTANTIATE_COMPARE(PCursor, PCursor::compare, template); #endif diff --git a/flower/include/pcursor.tcc b/flower/include/pcursor.tcc index ffb01bcfe8..e8de3d5da1 100644 --- a/flower/include/pcursor.tcc +++ b/flower/include/pcursor.tcc @@ -4,12 +4,12 @@ template void PCursor::junk() { -#if !defined(NDEBUG) && defined(PARANOID) +#if !defined (NDEBUG) && defined (PARANOID) list().OK(); #endif delete ptr(); -#if !defined(NDEBUG)&&defined(PARANOID) +#if !defined (NDEBUG)&&defined (PARANOID) thing() = 0; list().OK(); #endif diff --git a/flower/include/plist.hh b/flower/include/plist.hh index af27832f00..f052e47368 100644 --- a/flower/include/plist.hh +++ b/flower/include/plist.hh @@ -28,8 +28,8 @@ class Link_list : public List PCursor bottom() const { return PCursor (List::bottom()); } - PCursor find(T) const; - void concatenate(Link_list const &s) { List::concatenate(s); } + PCursor find (T) const; + void concatenate (Link_list const &s) { List::concatenate (s); } Link_list() {} }; @@ -55,19 +55,19 @@ class Pointer_list : public Link_list { public: void junk(); - Pointer_list(Pointer_list const &) { set_empty(); } + Pointer_list (Pointer_list const &) { set_empty(); } Pointer_list() { } - ~Pointer_list() { junk(); } + ~Pointer_list() { junk (); } }; #define Pointer_list__copy(T, to, from, op) \ for (PCursor _pc_(from); _pc_.ok(); _pc_++)\ - to.bottom().add(_pc_->op)\ + to.bottom().add (_pc_->op)\ \ template -void PL_copy(Pointer_list &dst,Pointer_list const&src); +void PL_copy (Pointer_list &dst,Pointer_list const&src); diff --git a/flower/include/plist.icc b/flower/include/plist.icc index 80ce1ba198..f4a3713761 100644 --- a/flower/include/plist.icc +++ b/flower/include/plist.icc @@ -9,12 +9,12 @@ template void -PL_copy(Pointer_list &to, Pointer_list const&src) +PL_copy (Pointer_list &to, Pointer_list const&src) { - for (PCursor pc(src); pc.ok(); pc++) { + for (PCursor pc (src); pc.ok(); pc++) { T *q = pc; T *p=new T(*q) ; - to.bottom().add(p); + to.bottom().add (p); } } diff --git a/flower/include/pointer.hh b/flower/include/pointer.hh index 58f8e198b0..cc8097c360 100644 --- a/flower/include/pointer.hh +++ b/flower/include/pointer.hh @@ -23,7 +23,7 @@ class P { /** Set contents to a copy of #t_l# */ - void copy(T const*t_l); + void copy (T const*t_l); T* t_p; /** @@ -63,7 +63,7 @@ public: //P(T *p) { t_p = p; } T *operator ->() { return t_p; } - operator T * () { return t_p; } + operator T *() { return t_p; } const T *operator ->() const { return t_p ; } T &operator *() { return *t_p; } T const &operator *() const { return *t_p; } diff --git a/flower/include/pointer.tcc b/flower/include/pointer.tcc index 80cadfd23a..c35f92c497 100644 --- a/flower/include/pointer.tcc +++ b/flower/include/pointer.tcc @@ -21,7 +21,7 @@ P::copy_p()const template inline void -P::copy(T const *l_C) +P::copy (T const *l_C) { t_p = l_C ? new T(*l_C) : 0; } @@ -48,7 +48,7 @@ P & P::operator =(P const&s) { junk(); - copy(s.t_p); + copy (s.t_p); return *this; } @@ -61,7 +61,7 @@ P::~P() { template inline void -P::set_p(T * np) +P::set_p (T * np) { if (np == t_p) return; @@ -74,13 +74,13 @@ P::set_p(T * np) template inline void -P::set_l(T const * l_C) +P::set_l (T const * l_C) { if (t_p == l_C) return; junk(); - copy(l_C); + copy (l_C); } diff --git a/flower/include/pqueue.hh b/flower/include/pqueue.hh index 846b870089..5f4a97fb47 100644 --- a/flower/include/pqueue.hh +++ b/flower/include/pqueue.hh @@ -21,7 +21,7 @@ struct PQueue_ent template int compare (PQueue_ent const &e1 , PQueue_ent const &e2) { - return compare(e1.key , e2.key); + return compare (e1.key , e2.key); } /** @@ -35,10 +35,10 @@ int compare (PQueue_ent const &e1 , PQueue_ent const &e2) { template class PQueue { Array heap_arr_; - T &elt(int i) { + T &elt (int i) { return heap_arr_[i-1]; } - T const&elt(int i) const { + T const&elt (int i) const { return heap_arr_[i-1]; } public: @@ -52,25 +52,25 @@ public: { #ifndef NDEBUG for (int i =2; i <= size(); i++) - assert(compare (elt(i/2), elt(i)) <= 0); + assert (compare (elt (i/2), elt (i)) <= 0); #endif } - T front () const { return elt(1); } - int size() const { return heap_arr_.size(); } - void insert(T v) { - heap_arr_.push(v); + T front() const { return elt (1); } + int size() const { return heap_arr_.size (); } + void insert (T v) { + heap_arr_.push (v); int i = heap_arr_.size(); int j = i / 2 ; while (j) { - if (compare(elt(j), v) > 0) { - elt(i) = elt(j); + if (compare (elt (j), v) > 0) { + elt (i) = elt (j); i = j; j = i/2; } else { break; } } - elt(i) = v; + elt (i) = v; OK(); } T max() const { @@ -78,23 +78,23 @@ public: T max_t; return max_t; } - void delmin( ) { - assert(size()); + void delmin() { + assert (size()); T last = heap_arr_.top(); int mini=2; int lasti=1; - while ( mini < size() ) { - if (compare(elt(mini + 1), elt(mini)) <0) + while ( mini < size()) { + if (compare (elt (mini + 1), elt (mini)) <0) mini++; - if (compare(last,elt(mini) ) < 0) + if (compare (last,elt (mini)) < 0) break; - elt(lasti) = elt(mini); + elt (lasti) = elt (mini); lasti = mini; mini *= 2; } - elt(lasti) = last; + elt (lasti) = last; heap_arr_.pop(); OK(); } diff --git a/flower/include/priorities.hh b/flower/include/priorities.hh index 8b12766240..59949bd860 100644 --- a/flower/include/priorities.hh +++ b/flower/include/priorities.hh @@ -18,16 +18,16 @@ template struct Priorities : Array { - void insert(K k) + void insert (K k) { int i=0; for (; i < size(); i++) { - if(elem(i) == k) + if (elem (i) == k) return; - if (elem(i) > k ) + if (elem (i) > k) break; } - Array::insert(k, i); + Array::insert (k, i); } }; #endif // PRIORITIES_HH diff --git a/flower/include/rational.hh b/flower/include/rational.hh index d3b68f726f..51426dd063 100644 --- a/flower/include/rational.hh +++ b/flower/include/rational.hh @@ -12,6 +12,6 @@ #include /// print a Rational. To be called from the debugger -void print_rat(Rational const&); +void print_rat (Rational const&); #endif // RATIONAL_HH diff --git a/flower/include/real.hh b/flower/include/real.hh index 457b82f967..2e8b160a22 100644 --- a/flower/include/real.hh +++ b/flower/include/real.hh @@ -20,9 +20,9 @@ typedef double Real; const Real infinity_f = HUGE_VAL; inline Real -distance(Real x,Real y) +distance (Real x,Real y) { - return abs(x-y); + return abs (x-y); } #endif diff --git a/flower/include/scalar.hh b/flower/include/scalar.hh index 08897ce50c..d081b56fe6 100644 --- a/flower/include/scalar.hh +++ b/flower/include/scalar.hh @@ -12,12 +12,12 @@ /// Perl -like scalar type. struct Scalar : public String { - Scalar(Real r) : String(r) {} - Scalar(int i) : String(i) {} - Scalar(char c) : String(c) {} - Scalar(char const *c) : String(c) {} - Scalar(String s ):String(s) {} - Scalar(Rational ); + Scalar (Real r) : String (r) {} + Scalar (int i) : String (i) {} + Scalar (char c) : String (c) {} + Scalar (char const *c) : String (c) {} + Scalar (String s):String (s) {} + Scalar (Rational); operator Rational(); Scalar() {} bool isnum(); diff --git a/flower/include/string-data.hh b/flower/include/string-data.hh index c79a6621ba..d4440b1c26 100644 --- a/flower/include/string-data.hh +++ b/flower/include/string-data.hh @@ -28,7 +28,7 @@ friend class String_handle; String_data(); /// init from src. Conservative allocation. - String_data(String_data const &src); + String_data (String_data const &src); ~String_data(); @@ -36,13 +36,13 @@ friend class String_handle; @param j, maximum stringlength_i_. contents thrown away. */ - void setmax(int j); + void setmax (int j); /** POST: maxlen >= j. @param j, maximum stringlength_i_. contents are kept if it grows. */ - void remax(int j); + void remax (int j); /// check if writeable. void OKW(); @@ -54,14 +54,14 @@ friend class String_handle; void tighten(); // assignment. - void set( Byte const* byte_C, int length_i ); + void set (Byte const* byte_C, int length_i); - void set( char const* ch_C ); + void set (char const* ch_C); /// concatenation. - void append( Byte const* byte_C, int length_i ); + void append (Byte const* byte_C, int length_i); - void operator += ( char const* ch_C ); + void operator += ( char const* ch_C); char const* ch_C() const; @@ -72,7 +72,7 @@ friend class String_handle; // idem, non const Byte* byte_l(); - void trunc(int j); + void trunc (int j); /** access element. not really safe. Can alter length_i_ without #String_data# knowing it. */ diff --git a/flower/include/string-data.icc b/flower/include/string-data.icc index 5a3bb390ef..2a285db24f 100644 --- a/flower/include/string-data.icc +++ b/flower/include/string-data.icc @@ -26,9 +26,9 @@ String_data::OKW() INLINE void String_data::OK() { - assert(maxlen >= length_i_); - assert(bool(data_byte_p_)); - assert(references >= 1); + assert (maxlen >= length_i_); + assert (bool (data_byte_p_)); + assert (references >= 1); } @@ -43,23 +43,23 @@ String_data::String_data() } INLINE -String_data::String_data(String_data const &src) +String_data::String_data (String_data const &src) { references=0; maxlen = length_i_ = src.length_i_; data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead. - memcpy( data_byte_p_, src.data_byte_p_, length_i_ + 1 ); + memcpy (data_byte_p_, src.data_byte_p_, length_i_ + 1); } INLINE String_data::~String_data() { - assert(references == 0); + assert (references == 0); delete[] data_byte_p_; } INLINE void -String_data::setmax(int j) +String_data::setmax (int j) { OKW(); if (j > maxlen) { @@ -82,12 +82,12 @@ String_data::setmax(int j) define change authority */ INLINE void -String_data::remax(int j) +String_data::remax (int j) { OKW(); if (j > maxlen) { Byte *p = new Byte[j + 1]; - memcpy( p, data_byte_p_, ( maxlen = 0 && j <= length_i_); + assert (j >= 0 && j <= length_i_); data_byte_p_[j] = 0; length_i_ = j; } @@ -186,21 +186,21 @@ String_data::trunc(int j) INLINE bool String_data::is_binary_bo()const { -// return !memchr(data_byte_p_, length_i_, 0); - return ( (int)strlen( (char const*)data_byte_p_ ) != length_i_ ); +// return !memchr (data_byte_p_, length_i_, 0); + return ( (int)strlen ((char const*)data_byte_p_) != length_i_ ); } INLINE Byte& String_data::operator [](int j) { - assert(j >= 0 && j <= length_i_); + assert (j >= 0 && j <= length_i_); return data_byte_p_[j] ; } INLINE Byte String_data::operator [](int j) const { - assert(j >= 0 && j <= length_i_); + assert (j >= 0 && j <= length_i_); return data_byte_p_[j]; } diff --git a/flower/include/string-handle.hh b/flower/include/string-handle.hh index a18fcc28ed..c6e73ada10 100644 --- a/flower/include/string-handle.hh +++ b/flower/include/string-handle.hh @@ -26,7 +26,7 @@ class String_handle { void down(); /// increase ref count - void up(String_data *d); + void up (String_data *d); /** make sure data has only one reference. POST: data->references == 1 @@ -36,7 +36,7 @@ class String_handle { public: String_handle(); ~String_handle(); - String_handle(String_handle const & src); + String_handle (String_handle const & src); Byte const* byte_C() const; char const* ch_C() const; @@ -51,10 +51,10 @@ public: don't use this for loops. Use byte_C() */ Byte &operator[](int j); - void append( Byte const* byte_C, int length_i ); - void set( Byte const* byte_C, int length_i ); + void append (Byte const* byte_C, int length_i); + void set (Byte const* byte_C, int length_i); void operator = (char const *p); - void trunc(int j); + void trunc (int j); int length_i() const; }; diff --git a/flower/include/string-handle.icc b/flower/include/string-handle.icc index 63b2ab379d..e398e0a4ed 100644 --- a/flower/include/string-handle.icc +++ b/flower/include/string-handle.icc @@ -24,7 +24,7 @@ String_handle::down() /// increase ref count INLINE void -String_handle::up(String_data *d) +String_handle::up (String_data *d) { data=d; data->references ++; } @@ -33,16 +33,16 @@ INLINE void String_handle::copy() { if (data->references !=1){ - String_data *newdata = new String_data(*data); + String_data *newdata = new String_data (*data); down(); - up(newdata); + up (newdata); } } INLINE String_handle::String_handle() { - up(new String_data); + up (new String_data); } INLINE @@ -52,9 +52,9 @@ String_handle::~String_handle() } INLINE -String_handle::String_handle(String_handle const & src) +String_handle::String_handle (String_handle const & src) { - up(src.data); + up (src.data); } INLINE Byte* @@ -89,7 +89,7 @@ String_handle::operator =(String_handle const &src) if (this == &src) return; down(); - up(src.data); + up (src.data); } INLINE void @@ -116,30 +116,30 @@ String_handle::operator[](int j) } INLINE void -String_handle::append( Byte const* byte_C, int length_i ) +String_handle::append (Byte const* byte_C, int length_i) { copy(); - data->append( byte_C, length_i ); + data->append (byte_C, length_i); } INLINE void -String_handle::set( Byte const* byte_C, int length_i ) +String_handle::set (Byte const* byte_C, int length_i) { copy(); - data->set( byte_C, length_i ); + data->set (byte_C, length_i); } INLINE void String_handle::operator = (char const *p) { copy(); - data->set( p ); + data->set (p); } INLINE void -String_handle::trunc(int j) +String_handle::trunc (int j) { - copy(); data->trunc(j); + copy(); data->trunc (j); } INLINE int diff --git a/flower/include/string.hh b/flower/include/string.hh index 0e0b9fb4dd..3d8981faf0 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -62,19 +62,19 @@ public: /** init to empty string. This is needed because other constructors are provided.*/ String() { } - String(Rational); + String (Rational); /// String s = "abc"; - String( char const* source ); - String( Byte const* byte_C, int length_i ); + String (char const* source); + String (Byte const* byte_C, int length_i); /// "ccccc" - String( char c, int n = 1 ); + String (char c, int n = 1); - String( int i , char const *fmt=0); + String (int i , char const *fmt=0); String ( double f , char const* fmt =0); /// 'true' or 'false' - String(bool ); + String (bool); /// return a "new"-ed copy of contents Byte* copy_byte_p() const; // return a "new"-ed copy of contents @@ -85,24 +85,24 @@ public: Byte* byte_l(); /// deprecated; use ch_C() - operator char const* () const { return ch_C(); } + operator char const*() const { return ch_C(); } - String &operator =( String const & source ); + String &operator =( String const & source); /// concatenate s void operator += (char const* s) { strh_ += s; } void operator += (String s); - void append(String); - void prepend(String); + void append (String); + void prepend (String); - char operator []( int n ) const { return strh_[n]; } + char operator []( int n) const { return strh_[n]; } /// return n leftmost chars - String left_str( int n ) const; + String left_str (int n) const; /// return n rightmost chars - String right_str( int n ) const; + String right_str (int n) const; /// return uppercase of *this String upper_str() const; @@ -115,28 +115,28 @@ public: /// return a piece starting at index_i (first char = index_i 0), length n - String mid_str(int index_i, int n ) const; + String mid_str (int index_i, int n) const; /// cut out a middle piece, return remainder - String nomid_str(int index_i, int n ) const; + String nomid_str (int index_i, int n) const; /// signed comparison, analogous to memcmp; - static int compare_i(String const & s1,const String& s2); + static int compare_i (String const & s1,const String& s2); /// index of rightmost c - int index_last_i( char c) const; + int index_last_i (char c) const; /// index of rightmost element of string - int index_last_i( char const* string ) const; + int index_last_i (char const* string) const; - int index_i(char c ) const; - int index_i(String ) const; - int index_any_i(String ) const; + int index_i (char c) const; + int index_i (String) const; + int index_any_i (String) const; void to_upper(); void to_lower(); /// provide Stream output - void print_on(ostream& os) const; + void print_on (ostream& os) const; /// the length of the string int length_i() const; @@ -155,21 +155,21 @@ public: #include "compare.hh" -instantiate_compare(String const &, String::compare_i); +INSTANTIATE_COMPARE(String const &, String::compare_i); // because char const* also has an operator ==, this is for safety: inline bool operator==(String s1, char const* s2){ - return s1 == String(s2); + return s1 == String (s2); } inline bool operator==(char const* s1, String s2) { - return String(s1)==s2; + return String (s1)==s2; } -inline bool operator!=(String s1, char const* s2 ) { - return s1!=String(s2); +inline bool operator!=(String s1, char const* s2 ) { + return s1!=String (s2); } inline bool operator!=(char const* s1,String s2) { - return String(s2) !=s1; + return String (s2) !=s1; } @@ -181,13 +181,10 @@ operator + (String s1, String s2) } inline ostream & -operator << ( ostream& os, String d ) +operator << ( ostream& os, String d) { - d.print_on(os); + d.print_on (os); return os; } - -// String quoteString(String message, String quote); - #endif diff --git a/flower/include/text-db.hh b/flower/include/text-db.hh index 3535a84f8f..ab3e9c82b5 100644 --- a/flower/include/text-db.hh +++ b/flower/include/text-db.hh @@ -14,14 +14,14 @@ public: Text_record() { } // needed because of other ctor /// report an error in this line. - message(String s) { + message (String s) { cerr << '\n'<< filename << ": "<< line_no << s << "\n"; } String operator[](int j) { return Array::operator[](j); } - Text_record(Array s, String fn, int j) : Array(s) { + Text_record (Array s, String fn, int j) : Array(s) { filename = fn; line_no = j; } Array::size; @@ -38,7 +38,7 @@ public: /// get a line with records Text_record get_record(); - Text_db(String fn):Data_file(fn) { } + Text_db (String fn):Data_file (fn) { } Data_file::error; bool eof(); diff --git a/flower/include/text-stream.hh b/flower/include/text-stream.hh index 437f8698c7..c921ebc2d3 100644 --- a/flower/include/text-stream.hh +++ b/flower/include/text-stream.hh @@ -26,17 +26,17 @@ class Text_stream String name; public: - Text_stream(String fn); + Text_stream (String fn); String get_name() { return name; } bool eof() { - return feof(f); + return feof (f); } bool eol() { return (peek() == '\n'); } char peek() { char c = get(); - unget(c); + unget (c); return c; } int line(){ @@ -47,7 +47,7 @@ class Text_stream char c; if (pushback.empty()) - c = getc(f); + c = getc (f); else c = pushback.pop(); @@ -55,20 +55,20 @@ class Text_stream line_no++; return c; } - void unget(char c) { + void unget (char c) { if (c =='\n') line_no--; - pushback.push(c); + pushback.push (c); } - ~Text_stream (){ + ~Text_stream(){ if (!eof()) cerr <<__FUNCTION__<< ": closing unended file"; - fclose(f); + fclose (f); } /// GNU format message. - void message(String s); + void message (String s); }; #endif diff --git a/flower/include/unionfind.hh b/flower/include/unionfind.hh index fbaa51e731..94a3e9f667 100644 --- a/flower/include/unionfind.hh +++ b/flower/include/unionfind.hh @@ -7,16 +7,16 @@ 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 + 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); - bool equiv(int i, int j) { return find(i) == find(j); } - Union_find(int sz); + void connect (int i, int j); + int find (int i); + bool equiv (int i, int j) { return find (i) == find (j); } + Union_find (int sz); private: Array classes; diff --git a/flower/include/varray.hh b/flower/include/varray.hh index 6f0e18aedc..60b72d299a 100644 --- a/flower/include/varray.hh +++ b/flower/include/varray.hh @@ -10,7 +10,7 @@ /// copy a bare (C-)array from #src# to #dest# sized #count# template -inline void arrcpy(T*dest, T*src, int count) { +inline void arrcpy (T*dest, T*src, int count) { for (int i=0; i < count ; i++) *dest++ = *src++; } @@ -42,10 +42,10 @@ protected: T *thearray; /// stretch or shrink array. - void remax(int newmax) { + void remax (int newmax) { T* newarr = new T[newmax]; size_ = (newmax < size_) ? newmax : size_; - arrcpy(newarr, thearray, size_); + arrcpy (newarr, thearray, size_); delete[] thearray; thearray = newarr; @@ -56,8 +56,8 @@ protected: public: /// check invariants void OK() const { - assert(max >= size_ && size_ >=0); - if (max) assert(thearray); + assert (max >= size_ && size_ >=0); + if (max) assert (thearray); } /** report the size_. @see {setsize_} @@ -73,8 +73,8 @@ public: /** set the size_ to #s#. POST: size() == s. Warning: contents are unspecified */ - void set_size(int s) { - if (s >= max) remax(s); + void set_size (int s) { + if (s >= max) remax (s); size_ = s; } @@ -83,44 +83,44 @@ public: /// return a "new"ed copy of array T* copy_array() const { T* Tarray = new T[size_]; - arrcpy(Tarray, thearray, size_); + arrcpy (Tarray, thearray, size_); return Tarray; } // depracated - operator T* () const { + operator T*() const { return copy_array(); } void operator=(Array const & src) { set_size (src.size_); - arrcpy(thearray,src.thearray, size_); + arrcpy (thearray,src.thearray, size_); } - Array(Array const & src) { + Array (Array const & src) { thearray = src.copy_array(); max = size_ = src.size_; } /// tighten array size_. - void precompute () { remax(size_); } + void precompute() { remax (size_); } /// access element T &operator[] (int i) { - return elem(i); + return elem (i); } /// access element T const & operator[] (int i) const { - return elem(i); + return elem (i); } /// access element - T &elem( int i) const { - assert(i >=0&&i=0&&i=0 && j<= size_); - set_size(size_+1); + void insert (T k, int j) { + assert (j >=0 && j<= size_); + set_size (size_+1); for (int i=size_-1; i > j; i--) thearray[i] = thearray[i-1]; thearray[j] = k; @@ -159,56 +159,56 @@ public: /** remove i-th element, and return it. */ - T get(int i) { - T t = elem(i); + T get (int i) { + T t = elem (i); del (i); return t; } - void unordered_del(int i) + void unordered_del (int i) { - elem(i) = top(); - set_size(size() -1); + elem (i) = top(); + set_size (size() -1); } - void del(int i) { - assert(i >=0&& i < size_); - arrcpy(thearray+i, thearray+i+1, size_-i-1); + void del (int i) { + assert (i >=0&& i < size_); + arrcpy (thearray+i, thearray+i+1, size_-i-1); size_--; } // quicksort. void sort (int (*compare)( T const&,T const&), - int lower = -1, int upper = -1 ) { + int lower = -1, int upper = -1) { if (lower < 0) { lower = 0 ; upper = size()-1; } if (lower >= upper) return; - swap(lower, (lower+upper)/2); + swap (lower, (lower+upper)/2); int last = lower; for (int i= lower +1; i <= upper; i++) - if (compare(thearray[i], thearray[lower]) < 0 ) - swap( ++last,i); - swap(lower, last); - sort(compare, lower, last-1); - sort(compare, last+1, upper); + if (compare (thearray[i], thearray[lower]) < 0) + swap (++last,i); + swap (lower, last); + sort (compare, lower, last-1); + sort (compare, last+1, upper); } - void concat(Array const &src) { + void concat (Array const &src) { int s = size_; - set_size(size_ + src.size_); - arrcpy(thearray+s,src.thearray, src.size_); + set_size (size_ + src.size_); + arrcpy (thearray+s,src.thearray, src.size_); } - Array slice(int lower, int upper) { - assert(lower >= 0 && lower <=upper&& upper <= size_); + Array slice (int lower, int upper) { + assert (lower >= 0 && lower <=upper&& upper <= size_); Array r; int s =upper-lower; - r.set_size(s); - arrcpy(r.thearray, thearray + lower, s); + r.set_size (s); + arrcpy (r.thearray, thearray + lower, s); return r; } void reverse() { int h = size_/2; for (int i =0,j = size_-1; i < h; i++,j--) - swap(i,j); + swap (i,j); } }; diff --git a/flower/include/vector.hh b/flower/include/vector.hh index 7f75735344..2d2772336b 100644 --- a/flower/include/vector.hh +++ b/flower/include/vector.hh @@ -15,31 +15,31 @@ class Vector { Array dat; public: void OK() const { dat.OK();} - int dim() const { return dat.size(); } + int dim() const { return dat.size (); } Vector() { } - Vector(Array d ); - Vector(Vector const &n); - Vector(int n) { - dat.set_size(n); - fill(0); + Vector (Array d); + Vector (Vector const &n); + Vector (int n) { + dat.set_size (n); + fill (0); } - void set_dim(int i) + void set_dim (int i) { - dat.set_size(i); + dat.set_size (i); } - void insert(Real v, int i) { - dat.insert(v,i); + void insert (Real v, int i) { + dat.insert (v,i); } - void del(int i) { dat.del(i); } + void del (int i) { dat.del (i); } operator String() const; - void fill(Real r) { + void fill (Real r) { for (int i=0; i < dim(); i++) dat[i] =r; } void operator +=(Vector v) { - assert(v.dim() == dim()); + assert (v.dim() == dim ()); for (int i=0; i < dim(); i++) dat[i] += v.dat[i]; } @@ -54,32 +54,32 @@ public: } void operator -=(Vector v) { - assert(v.dim() == dim()); + assert (v.dim() == dim ()); for (int i=0; i < dim(); i++) - dat[i] -= v(i); + dat[i] -= v (i); } Real &operator()(int i) { return dat[i]; } Real operator()(int i) const { return dat[i]; } - Real elem(int i) { return dat[i]; } + Real elem (int i) { return dat[i]; } Real operator *(Vector v) const { Real ip=0; - assert(v.dim() == dim()); + assert (v.dim() == dim ()); for (int i=0; i < dim(); i++) - ip += dat[i] *v(i); + ip += dat[i] *v (i); return ip; } Vector operator-() const; Real norm() { - return sqrt(norm_sq() ); + return sqrt (norm_sq()); } Real norm_sq() { return ((*this) * (*this)); } - operator Array () { return dat; } + operator Array() { return dat; } void print() const; /// set to j-th element of unit-base - void set_unit(int j) ; + void set_unit (int j) ; }; inline Vector diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh index ceb12694e3..e56496605d 100644 --- a/flower/include/virtual-methods.hh +++ b/flower/include/virtual-methods.hh @@ -12,13 +12,13 @@ /** a macro to declare the classes name as a static and virtual function. The static_name() can *not* be inlined (this might have the effect that - s->name() != S::static_name(). Overlapping strings need not be merged in C++ + s->name() != S::static_name (). Overlapping strings need not be merged in C++ */ #define DECLARE_MY_RUNTIME_TYPEINFO \ static char const *static_name();\ -static bool static_is_type_b(const char*s);\ -virtual bool is_type_b(const char *s)const { return static_is_type_b(s); } \ -virtual char const *name() const{ return static_name(); } \ +static bool static_is_type_b (const char*s);\ +virtual bool is_type_b (const char *s)const { return static_is_type_b (s); } \ +virtual char const *name() const{ return static_name (); } \ int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out() #define IMPLEMENT_STATIC_NAME(c)\ @@ -38,22 +38,22 @@ int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out() #define IMPLEMENT_IS_TYPE_B(D) \ IMPLEMENT_STATIC_NAME(D)\ - bool D::static_is_type_b(const char *s) \ + bool D::static_is_type_b (const char *s) \ { \ return s == static_name(); \ } #define IMPLEMENT_IS_TYPE_B1(D,B) \ IMPLEMENT_STATIC_NAME(D)\ - bool D::static_is_type_b(const char *s) \ + bool D::static_is_type_b (const char *s) \ { \ - return s == static_name() || B::static_is_type_b(s); \ + return s == static_name() || B::static_is_type_b (s); \ } #define IMPLEMENT_IS_TYPE_B2(D, BA, BB) \ IMPLEMENT_STATIC_NAME(D)\ - bool D::static_is_type_b(const char *s) \ + bool D::static_is_type_b (const char *s) \ { \ - return s == static_name() || BA::static_is_type_b(s) || BB::static_is_type_b(s); \ + return s == static_name() || BA::static_is_type_b (s) || BB::static_is_type_b (s); \ } #endif diff --git a/flower/lgetopt.cc b/flower/lgetopt.cc index afffc2f4b2..7ab4eb122b 100644 --- a/flower/lgetopt.cc +++ b/flower/lgetopt.cc @@ -13,8 +13,8 @@ Getopt_long::argument_to_i() { long l; if (!optional_argument_ch_C_ - || sscanf(optional_argument_ch_C_, "%ld", &l) != 1) - report(E_ILLEGALARG); + || sscanf (optional_argument_ch_C_, "%ld", &l) != 1) + report (E_ILLEGALARG); return l; } @@ -23,23 +23,23 @@ const Long_option_init * Getopt_long::parselong() { char const *optnm = arg_value_ch_a_a_[array_index_i_] + 2 ; - assert(*optnm); + assert (*optnm); - char const *endopt = strchr(optnm, '='); - int searchlen = (endopt) ? endopt - optnm : strlen(optnm); + char const *endopt = strchr (optnm, '='); + int searchlen = (endopt) ? endopt - optnm : strlen (optnm); found_option_l_=0; for (int i=0; i< table_len_i_; i++) { char const *ln = option_a_[i].longname; - if (ln && !strncmp(ln, optnm, searchlen)) { + if (ln && !strncmp (ln, optnm, searchlen)) { found_option_l_ = option_a_+i; break; } } if (!found_option_l_) { - report(E_UNKNOWNOPTION); + report (E_UNKNOWNOPTION); return 0; } array_index_i_++; @@ -54,12 +54,12 @@ Getopt_long::parselong() array_index_i_++; } if (!optional_argument_ch_C_) - report(E_ARGEXPECT); + report (E_ARGEXPECT); } else { optional_argument_ch_C_ = 0; if (endopt) - report(E_NOARGEXPECT); + report (E_NOARGEXPECT); } return found_option_l_; @@ -67,7 +67,7 @@ Getopt_long::parselong() void -Long_option_init::printon(ostream &errorout)const +Long_option_init::printon (ostream &errorout)const { if (shortname) errorout <<"-" << shortname; @@ -79,7 +79,7 @@ Long_option_init::printon(ostream &errorout)const // report an error, GNU style. void -Getopt_long::report(Errorcod c) +Getopt_long::report (Errorcod c) { error_ = c; if (!error_ostream_l_) @@ -89,7 +89,7 @@ Getopt_long::report(Errorcod c) switch (c) { case E_ARGEXPECT: *error_ostream_l_<< "option "; - found_option_l_->printon(*error_ostream_l_); + found_option_l_->printon (*error_ostream_l_); *error_ostream_l_ << "requires an argument"<printon(*error_ostream_l_); + found_option_l_->printon (*error_ostream_l_); *error_ostream_l_ << '\n'; default: - assert(false); + assert (false); } - exit(2); + exit (2); } const Long_option_init * @@ -120,7 +120,7 @@ Getopt_long::parseshort() { char c=arg_value_ch_a_a_[array_index_i_][argument_index_i_]; found_option_l_=0; - assert(c); + assert (c); for (int i=0; i < table_len_i_; i++) if (option_a_[i].shortname == c) { @@ -129,7 +129,7 @@ Getopt_long::parseshort() } if (!found_option_l_){ - report(E_UNKNOWNOPTION); + report (E_UNKNOWNOPTION); return 0; } @@ -148,7 +148,7 @@ Getopt_long::parseshort() array_index_i_ ++; } if (!optional_argument_ch_C_) { - report(E_ARGEXPECT); + report (E_ARGEXPECT); } return found_option_l_; @@ -171,7 +171,7 @@ Getopt_long::operator()() return 0; if (argument_C[1] == '-') {// what to do with "command -- bla" - if ( argument_C[2] ) + if ( argument_C[2]) return parselong(); else return 0; @@ -185,7 +185,7 @@ Getopt_long::operator()() } } -Getopt_long::Getopt_long(int c, char **v, Long_option_init *lo) +Getopt_long::Getopt_long (int c, char **v, Long_option_init *lo) { option_a_ = lo; error_ostream_l_ = &cerr; diff --git a/flower/libc-extension.cc b/flower/libc-extension.cc index 6e9a9b77a6..c786a51efe 100644 --- a/flower/libc-extension.cc +++ b/flower/libc-extension.cc @@ -13,21 +13,21 @@ char* -strnlwr( char* start_l ,int n) +strnlwr (char* start_l ,int n) { char * p = start_l + n; while ( --p >= start_l) { - *p = tolower( *p ); /* a macro on some compilers */ + *p = tolower (*p); /* a macro on some compilers */ } return start_l; } char* -strnupr( char* start_l, int n) +strnupr (char* start_l, int n) { char * p = start_l + n; while ( --p >= start_l) { - *p = toupper( *p ); /* a macro on some compilers */ + *p = toupper (*p); /* a macro on some compilers */ } return start_l; } @@ -39,7 +39,7 @@ strnupr( char* start_l, int n) */ char * -memmem(Byte const * haystack, int haystack_len, +memmem (Byte const * haystack, int haystack_len, Byte const *needle,int needle_len) { Byte const * end_haystack = haystack + haystack_len - needle_len; @@ -65,7 +65,7 @@ memmem(Byte const * haystack, int haystack_len, #endif Byte * -memrchr(Byte const * p, int n, char c) +memrchr (Byte const * p, int n, char c) { const Byte * q = p+n; while (q > p) { @@ -78,7 +78,7 @@ memrchr(Byte const * p, int n, char c) template inline void -my_swap(T &t1, T &t2, T &tmp) +my_swap (T &t1, T &t2, T &tmp) { tmp = t1; t1 = t2; @@ -86,27 +86,27 @@ my_swap(T &t1, T &t2, T &tmp) } Byte* -strrev( Byte* byte_l, int length_i ) +strrev (Byte* byte_l, int length_i) { Byte tmp_byte; Byte* left_l = byte_l; Byte* right_l = byte_l + length_i; - while ( right_l > left_l ) { - my_swap(*right_l-- , *left_l++ , tmp_byte); + while ( right_l > left_l) { + my_swap (*right_l-- , *left_l++ , tmp_byte); } return byte_l; } #if ! HAVE_SNPRINTF int snprintf ( char *str, size_t, - char const *format, ... ) + char const *format, ...) { va_list ap; - va_start(ap, format); - int i = vsprintf(str, format, ap); - va_end(ap); + va_start (ap, format); + int i = vsprintf (str, format, ap); + va_end (ap); return i; } #endif diff --git a/flower/matrix-debug.cc b/flower/matrix-debug.cc index 099a05beb9..7126c1378e 100644 --- a/flower/matrix-debug.cc +++ b/flower/matrix-debug.cc @@ -17,10 +17,10 @@ Matrix::operator String() const String s; #ifndef NPRINT Matrix_storage const * stor_c_l = dat; - s=String("matrix { (") + dat->name() + ")\n"; + s=String ("matrix { (") + dat->name() + ")\n"; for (int i=0; i< rows(); i++){ for (int j = 0; j < cols(); j++) { - s+= String(stor_c_l->elem(i,j), "%6f "); + s+= String (stor_c_l->elem (i,j), "%6f "); } s+="\n"; } @@ -44,7 +44,7 @@ Vector::operator String() const #ifndef NPRINT s="vector ["; for (int i=0; i < dim(); i++) { - s += String(dat[i], "%6f") + String(' '); + s += String (dat[i], "%6f") + String (' '); } s+="]"; #endif diff --git a/flower/matrix-storage.cc b/flower/matrix-storage.cc index 54deb7d673..5ebc0e9072 100644 --- a/flower/matrix-storage.cc +++ b/flower/matrix-storage.cc @@ -10,32 +10,32 @@ #include "diagonal-storage.hh" void -Matrix_storage::set_addition_result(Matrix_storage *&dat, Matrix_storage *right) +Matrix_storage::set_addition_result (Matrix_storage *&dat, Matrix_storage *right) { - if (dat && dat->name() == Diagonal_storage::static_name() - && right->name() == Diagonal_storage::static_name()) { + if (dat && dat->name() == Diagonal_storage::static_name () + && right->name() == Diagonal_storage::static_name ()) { Diagonal_storage *L = (Diagonal_storage*)dat; Diagonal_storage* R = (Diagonal_storage*) right; - if ( R->band_size_i() > L->band_size_i()) { - L->set_band_size(R->band_size_i()); + if ( R->band_size_i() > L->band_size_i ()) { + L->set_band_size (R->band_size_i()); } return ; } - if (!dat || !dat->is_type_b(Full_storage::static_name() )) { + if (!dat || !dat->is_type_b (Full_storage::static_name())) { - Matrix_storage *new_stor = (dat)? new Full_storage(dat) : - new Full_storage( right->rows(), right->cols()); + Matrix_storage *new_stor = (dat)? new Full_storage (dat) : + new Full_storage (right->rows(), right->cols ()); delete dat; dat = new_stor; } } Matrix_storage* -Matrix_storage::get_product_result(Matrix_storage*left, Matrix_storage*right) +Matrix_storage::get_product_result (Matrix_storage*left, Matrix_storage*right) { Matrix_storage* dest =0; - set_product_result(dest, left,right); + set_product_result (dest, left,right); return dest; } @@ -44,96 +44,96 @@ Matrix_storage::get_product_result(Matrix_storage*left, Matrix_storage*right) hairy */ void -Matrix_storage::set_product_result(Matrix_storage*&dest, +Matrix_storage::set_product_result (Matrix_storage*&dest, Matrix_storage*left, Matrix_storage*right) { - if ( left->name() == Diagonal_storage::static_name() - && right->name() == Diagonal_storage::static_name()) { + if ( left->name() == Diagonal_storage::static_name () + && right->name() == Diagonal_storage::static_name ()) { Diagonal_storage *L = (Diagonal_storage*)left; Diagonal_storage* R = (Diagonal_storage*) right; - if (L->band_size_i() + R->band_size_i() < L->dim()/2 ) { - if (dest ->name() != Diagonal_storage::static_name()){ + if (L->band_size_i() + R->band_size_i () < L->dim ()/2) { + if (dest ->name() != Diagonal_storage::static_name ()){ delete dest; dest = new Diagonal_storage; } - dest->set_size(L->dim()); + dest->set_size (L->dim()); return; } } - if ( dest && dest->name() == Full_storage::static_name()) { - dest->set_size(left->rows(), right->cols()); + if ( dest && dest->name() == Full_storage::static_name ()) { + dest->set_size (left->rows(), right->cols ()); } else { delete dest; - dest = new Full_storage( left->rows(), right->cols()); + dest = new Full_storage (left->rows(), right->cols ()); } } IMPLEMENT_IS_TYPE_B(Matrix_storage); Matrix_storage * -Matrix_storage::get_full(int n, int m) +Matrix_storage::get_full (int n, int m) { - return new Full_storage(n,m); + return new Full_storage (n,m); } bool -Matrix_storage::try_right_multiply(Matrix_storage *, +Matrix_storage::try_right_multiply (Matrix_storage *, const Matrix_storage *)const { return false; } Array -Matrix_storage::row(int n) const +Matrix_storage::row (int n) const { Array r; for (int j = 0; j < cols(); j++) - r.push(elem(n,j)); + r.push (elem (n,j)); return r; } Array -Matrix_storage::column(int n) const +Matrix_storage::column (int n) const { Array r; for (int i = 0; i < rows(); i++) - r.push(elem(i,n)); + r.push (elem (i,n)); return r; } void -Matrix_storage::set_size(int rows, int cols) +Matrix_storage::set_size (int rows, int cols) { - resize(rows,cols); + resize (rows,cols); } void -Matrix_storage::set_size(int rows) +Matrix_storage::set_size (int rows) { - resize(rows); + resize (rows); } void -Matrix_storage::set_band(Matrix_storage *&mat, int b) +Matrix_storage::set_band (Matrix_storage *&mat, int b) { - Matrix_storage* ns = new Diagonal_storage(mat, b); + Matrix_storage* ns = new Diagonal_storage (mat, b); delete mat; mat=ns; } void -Matrix_storage::set_full(Matrix_storage *&mat) +Matrix_storage::set_full (Matrix_storage *&mat) { - Matrix_storage* ns = new Full_storage(mat); + Matrix_storage* ns = new Full_storage (mat); delete mat; mat=ns; } diff --git a/flower/matrix.cc b/flower/matrix.cc index 7e1854827b..fdb6085f7c 100644 --- a/flower/matrix.cc +++ b/flower/matrix.cc @@ -13,14 +13,14 @@ bool Matrix::band_b()const { - return dat->is_type_b( Diagonal_storage::static_name()); + return dat->is_type_b (Diagonal_storage::static_name()); } void Matrix::set_full() const { - if ( dat->name() != Full_storage::static_name()) { - Matrix_storage::set_full( ((Matrix*)this)->dat ); + if ( dat->name() != Full_storage::static_name ()) { + Matrix_storage::set_full (((Matrix*)this)->dat); } } @@ -35,65 +35,65 @@ Matrix::try_set_band()const return; // it only looks constant Matrix*self = (Matrix*)this; - Matrix_storage::set_band(self->dat,b); + Matrix_storage::set_band (self->dat,b); } Real Matrix::norm() const { Real r =0.0; - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - r += sqr(dat->elem(i,j)); - return sqrt(r); + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + r += sqr (dat->elem (i,j)); + return sqrt (r); } void -Matrix::fill(Real r) +Matrix::fill (Real r) { - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dat->elem(i,j)=r; + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dat->elem (i,j)=r; } void -Matrix::set_diag(Real r) +Matrix::set_diag (Real r) { - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dat->elem(i,j)=(i==j) ? r: 0.0; + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dat->elem (i,j)=(i==j) ? r: 0.0; } void -Matrix::set_diag(Vector d) +Matrix::set_diag (Vector d) { - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dat->elem(i,j)=(i==j) ? d(i): 0.0; + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dat->elem (i,j)=(i==j) ? d (i): 0.0; } void Matrix::operator+=(Matrix const &m) { - Matrix_storage::set_addition_result(dat, m.dat); - assert(m.cols() == cols()); - assert(m.rows() == rows()); - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dat->elem(i,j) += m(i,j); + Matrix_storage::set_addition_result (dat, m.dat); + assert (m.cols() == cols ()); + assert (m.rows() == rows ()); + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dat->elem (i,j) += m (i,j); } void Matrix::operator-=(Matrix const &m) { - Matrix_storage::set_addition_result(dat, m.dat); - assert(m.cols() == cols()); - assert(m.rows() == rows()); - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dat->elem(i,j) -= m(i,j); + Matrix_storage::set_addition_result (dat, m.dat); + assert (m.cols() == cols ()); + assert (m.rows() == rows ()); + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dat->elem (i,j) -= m (i,j); } void Matrix::operator*=(Real a) { - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dat->elem(i,j) *= a; + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dat->elem (i,j) *= a; } void @@ -108,17 +108,17 @@ Matrix::operator=(Matrix const &m) int Matrix::band_i()const { - if ( band_b() ) { + if ( band_b()) { Diagonal_storage const * diag = (Diagonal_storage*) dat; return diag->band_size_i(); } int starty = dim(); - while (starty >= 0 ) { - for ( int i = starty, j = 0; i < dim(); i++, j++ ) - if (dat->elem( i,j )) + while (starty >= 0) { + for ( int i = starty, j = 0; i < dim(); i++, j++) + if (dat->elem (i,j)) goto gotcha; for ( int i=0, j = starty; j < dim(); i++,j++) - if (dat->elem(i,j)) + if (dat->elem (i,j)) goto gotcha; starty --; } @@ -126,7 +126,7 @@ gotcha: return starty; } -Matrix::Matrix(Matrix const &m) +Matrix::Matrix (Matrix const &m) { m.OK(); @@ -134,78 +134,78 @@ Matrix::Matrix(Matrix const &m) } -Matrix::Matrix(int n, int m) +Matrix::Matrix (int n, int m) { - dat = Matrix_storage::get_full(n,m); - fill(0); + dat = Matrix_storage::get_full (n,m); + fill (0); } -Matrix::Matrix(Matrix_storage*stor_p) +Matrix::Matrix (Matrix_storage*stor_p) { dat = stor_p; } -Matrix::Matrix(int n) +Matrix::Matrix (int n) { - dat = Matrix_storage::get_full(n,n); - fill(0); + dat = Matrix_storage::get_full (n,n); + fill (0); } -Matrix::Matrix(Vector v, Vector w) +Matrix::Matrix (Vector v, Vector w) { - dat = Matrix_storage::get_full(v.dim(), w.dim()); - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dat->elem(i,j)=v(i)*w(j); + dat = Matrix_storage::get_full (v.dim(), w.dim ()); + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dat->elem (i,j)=v (i)*w (j); } Vector -Matrix::row(int k) const +Matrix::row (int k) const { int n=cols(); - Vector v(n); - for(int i=0; i < n; i++) - v(i)=dat->elem(k,i); + Vector v (n); + for (int i=0; i < n; i++) + v (i)=dat->elem (k,i); return v; } Vector -Matrix::col(int k) const +Matrix::col (int k) const { int n=rows(); - Vector v(n); - for(int i=0; i < n; i++) - v(i)=dat->elem(i,k); + Vector v (n); + for (int i=0; i < n; i++) + v (i)=dat->elem (i,k); return v; } Vector -Matrix::left_multiply(Vector const & v) const +Matrix::left_multiply (Vector const & v) const { - Vector dest(v.dim()); - assert(dat->cols()==v.dim()); - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dest(i)+= dat->elem(j,i)*v(j); + Vector dest (v.dim()); + assert (dat->cols()==v.dim ()); + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dest (i)+= dat->elem (j,i)*v (j); return dest; } Vector Matrix::operator *(Vector const & v) const { - Vector dest(rows()); - assert(dat->cols()==v.dim()); - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) - dest(i)+= dat->elem(i,j)*v(j); + Vector dest (rows()); + assert (dat->cols()==v.dim ()); + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) + dest (i)+= dat->elem (i,j)*v (j); return dest; } Matrix operator /(Matrix const& m1,Real a) { - Matrix m(m1); + Matrix m (m1); m /= a; return m; } @@ -217,12 +217,12 @@ void Matrix::transpose() // delegate to storage? { #if 1 - for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) { + for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) { if (i >= j) continue; - Real r=dat->elem(i,j); - dat->elem(i,j) = dat->elem(j,i); - dat->elem(j,i)=r; + Real r=dat->elem (i,j); + dat->elem (i,j) = dat->elem (j,i); + dat->elem (j,i)=r; } #endif } @@ -231,7 +231,7 @@ Matrix Matrix::operator-() const { OK(); - Matrix m(*this); + Matrix m (*this); m*=-1.0; return m; } @@ -239,7 +239,7 @@ Matrix::operator-() const Matrix Matrix::transposed() const { - Matrix m(*this); + Matrix m (*this); m.transpose(); return m; } @@ -247,62 +247,62 @@ Matrix::transposed() const Matrix operator *(Matrix const &m1, Matrix const &m2) { - Matrix result(Matrix_storage::get_product_result(m1.dat, m2.dat)); + Matrix result (Matrix_storage::get_product_result (m1.dat, m2.dat)); - result.set_product(m1,m2); + result.set_product (m1,m2); return result; } void -Matrix::set_product(Matrix const &m1, Matrix const &m2) +Matrix::set_product (Matrix const &m1, Matrix const &m2) { - assert(m1.cols()==m2.rows()); - assert(cols()==m2.cols() && rows()==m1.rows()); + assert (m1.cols()==m2.rows ()); + assert (cols()==m2.cols () && rows ()==m1.rows ()); - if (m1.dat->try_right_multiply(dat, m2.dat)) + if (m1.dat->try_right_multiply (dat, m2.dat)) return; - for (int i=0, j=0; dat->mult_ok(i,j); - dat->mult_next(i,j)) { + for (int i=0, j=0; dat->mult_ok (i,j); + dat->mult_next (i,j)) { Real r=0.0; for (int k = 0; k < m1.cols(); k++) r += m1(i,k)*m2(k,j); - dat->elem(i,j)=r; + dat->elem (i,j)=r; } } void -Matrix::insert_row(Vector v, int k) +Matrix::insert_row (Vector v, int k) { int c = cols(); - assert(v.dim()==cols()); - dat->insert_row(k); + assert (v.dim()==cols ()); + dat->insert_row (k); for (int j=0; j < c; j++) - dat->elem(k,j)=v(j); + dat->elem (k,j)=v (j); } void -Matrix::swap_columns(int c1, int c2) +Matrix::swap_columns (int c1, int c2) { - assert(c1>=0&& c1 < cols()&&c2 < cols() && c2 >=0); + assert (c1>=0&& c1 < cols()&&c2 < cols () && c2 >=0); int r = rows(); for (int i=0; i< r; i++) { - Real r=dat->elem(i,c1); - dat->elem(i,c1) = dat->elem(i,c2); - dat->elem(i,c2)=r; + Real r=dat->elem (i,c1); + dat->elem (i,c1) = dat->elem (i,c2); + dat->elem (i,c2)=r; } } void -Matrix::swap_rows(int c1, int c2) +Matrix::swap_rows (int c1, int c2) { - assert(c1>=0&& c1 < rows()&&c2 < rows() && c2 >=0); + assert (c1>=0&& c1 < rows()&&c2 < rows () && c2 >=0); int c = cols(); for (int i=0; i< c; i++) { - Real r=dat->elem(c1,i); - dat->elem(c1,i) = dat->elem(c2,i); - dat->elem(c2,i)=r; + Real r=dat->elem (c1,i); + dat->elem (c1,i) = dat->elem (c2,i); + dat->elem (c2,i)=r; } } @@ -310,7 +310,7 @@ Matrix::swap_rows(int c1, int c2) int Matrix::dim() const { - assert(cols() == rows()); + assert (cols() == rows ()); return rows(); } diff --git a/flower/rational.cc b/flower/rational.cc index b1056c2430..5b36be916c 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -10,9 +10,9 @@ #include "string.hh" void -print_rat(Rational const &m) +print_rat (Rational const &m) { - cout << String(m) << flush; + cout << String (m) << flush; } diff --git a/flower/scalar.cc b/flower/scalar.cc index da86835063..1a5e54ec27 100644 --- a/flower/scalar.cc +++ b/flower/scalar.cc @@ -2,22 +2,22 @@ #include #include "scalar.hh" -Scalar::Scalar(Rational r) - :String(r) +Scalar::Scalar (Rational r) + :String (r) { } Scalar::operator Rational() { - int p = index_i('/'); + int p = index_i ('/'); if (p == -1) - return int(*this); + return int (*this); - String s2 = right_str(len()-p-1); - String s1 = left_str(p); + String s2 = right_str (len()-p-1); + String s1 = left_str (p); - return Rational(s1.value_i(), s2.value_i()); + return Rational (s1.value_i(), s2.value_i ()); } bool @@ -26,7 +26,7 @@ Scalar::isnum() int conv = false; if (len()) { long l =0; - conv = sscanf(strh_.ch_C(), "%ld", &l); + conv = sscanf (strh_.ch_C(), "%ld", &l); } return len() && conv; } diff --git a/flower/string-convert.cc b/flower/string-convert.cc index d1a9fe0575..2f5ab5bfa3 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -25,24 +25,24 @@ static const int STRING_BUFFER_LEN=1024; String -String_convert::bin2hex_str( String bin_str ) +String_convert::bin2hex_str (String bin_str) { String str; Byte const* byte_C = bin_str.byte_C(); - for ( int i = 0; i < bin_str.length_i(); i++ ) { - str += (char)nibble2hex_byte( *byte_C >> 4 ); - str += (char)nibble2hex_byte( *byte_C++ ); + for ( int i = 0; i < bin_str.length_i(); i++) { + str += (char)nibble2hex_byte (*byte_C >> 4); + str += (char)nibble2hex_byte (*byte_C++); } return str; } int -String_convert::bin2_i( String bin_str ) +String_convert::bin2_i (String bin_str) { - assert( bin_str.length_i() <= 4 ); + assert (bin_str.length_i() <= 4); int result_i = 0; - for ( int i = 0; i < bin_str.length_i(); i++ ) { + for ( int i = 0; i < bin_str.length_i(); i++) { result_i <<= 8; result_i += (Byte)bin_str[ i ]; } @@ -51,76 +51,76 @@ String_convert::bin2_i( String bin_str ) // breendet imp from String int -String_convert::dec2_i( String dec_str ) +String_convert::dec2_i (String dec_str) { - if ( !dec_str.length_i() ) + if ( !dec_str.length_i()) return 0; long l = 0; - int conv = sscanf( dec_str.ch_C(), "%ld", &l ); - assert( conv ); + int conv = sscanf (dec_str.ch_C(), "%ld", &l); + assert (conv); return (int)l; } String -String_convert::i64_str( I64 i64, char const* fmt) +String_convert::i64_str (I64 i64, char const* fmt) { char buffer[STRING_BUFFER_LEN]; - snprintf(buffer, STRING_BUFFER_LEN, - (fmt ? fmt : "%Ld"), i64 ); // assume radix 10 - return String(buffer); + snprintf (buffer, STRING_BUFFER_LEN, + (fmt ? fmt : "%Ld"), i64); // assume radix 10 + return String (buffer); } // breendet imp from String double -String_convert::dec2_f( String dec_str ) +String_convert::dec2_f (String dec_str) { - if ( !dec_str.length_i() ) + if ( !dec_str.length_i()) return 0; double d = 0; - int conv = sscanf( dec_str.ch_C(), "%lf", &d ); - assert( conv ); + int conv = sscanf (dec_str.ch_C(), "%lf", &d); + assert (conv); return d; } int -String_convert::hex2bin_i( String hex_str, String& bin_str_r ) +String_convert::hex2bin_i (String hex_str, String& bin_str_r) { - if ( hex_str.length_i() % 2 ) + if ( hex_str.length_i() % 2) hex_str = "0" + hex_str; bin_str_r = ""; Byte const* byte_C= hex_str.byte_C(); int i = 0; - while ( i < hex_str.length_i() ) { - int high_i = hex2nibble_i( *byte_C++ ); - int low_i = hex2nibble_i( *byte_C++ ); - if ( high_i < 0 || low_i < 0 ) + while ( i < hex_str.length_i()) { + int high_i = hex2nibble_i (*byte_C++); + int low_i = hex2nibble_i (*byte_C++); + if ( high_i < 0 || low_i < 0) return 1; // illegal char - bin_str_r += String( (char)( high_i << 4 | low_i ), 1 ); + bin_str_r += String ((char)( high_i << 4 | low_i), 1 ); i += 2; } return 0; } String -String_convert::hex2bin_str( String hex_str ) +String_convert::hex2bin_str (String hex_str) { String str; // silly, asserts should alway be "on"! -// assert( !hex2bin_i( hex_str, str ) ); - int error_i = hex2bin_i( hex_str, str ); - assert( !error_i ); +// assert (!hex2bin_i (hex_str, str) ); + int error_i = hex2bin_i (hex_str, str); + assert (!error_i); return str; } int -String_convert::hex2nibble_i( Byte byte ) +String_convert::hex2nibble_i (Byte byte) { - if ( byte >= '0' && byte <= '9' ) + if ( byte >= '0' && byte <= '9') return byte - '0'; - if ( byte >= 'A' && byte <= 'F' ) + if ( byte >= 'A' && byte <= 'F') return byte - 'A' + 10; if ( byte >= 'a' && byte <= 'f') return byte - 'a' + 10; @@ -129,57 +129,57 @@ String_convert::hex2nibble_i( Byte byte ) // stupido. Should use int_str() String -String_convert::i2dec_str( int i, int length_i, char ch ) +String_convert::i2dec_str (int i, int length_i, char ch) { char fill_ch = ch; if ( fill_ch) fill_ch = '0'; // ugh - String dec_str( i ); + String dec_str (i); // ugh - return String( fill_ch, length_i - dec_str.length_i() ) + dec_str; + return String (fill_ch, length_i - dec_str.length_i()) + dec_str; } // stupido. Should use int_str() String -String_convert::u2hex_str( unsigned u, int length_i, char fill_ch ) +String_convert::u2hex_str (unsigned u, int length_i, char fill_ch) { String str; - if ( !u ) + if ( !u) str = "0"; #if 1 // both go... - while ( u ) { - str = String( (char)( ( u % 16 )["0123456789abcdef"] ) ) + str; + while ( u) { + str = String ((char)( ( u % 16)["0123456789abcdef"] ) ) + str; u /= 16; } #else - str += int_str( u, "%x" ); // hmm. %lx vs. %x -> portability? + str += int_str (u, "%x"); // hmm. %lx vs. %x -> portability? #endif - str = String( fill_ch, length_i - str.length_i() ) + str; - while ( ( str.length_i() > length_i ) && ( str[ 0 ] == 'f' ) ) - str = str.mid_str( 2, INT_MAX ); + str = String (fill_ch, length_i - str.length_i()) + str; + while ( ( str.length_i() > length_i) && ( str[ 0 ] == 'f' ) ) + str = str.mid_str (2, INT_MAX); return str; } String -String_convert::i2hex_str( int i, int length_i, char fill_ch ) +String_convert::i2hex_str (int i, int length_i, char fill_ch) { - return u2hex_str( (unsigned)i, length_i, fill_ch ); + return u2hex_str ((unsigned)i, length_i, fill_ch); } Byte -String_convert::nibble2hex_byte( Byte byte ) +String_convert::nibble2hex_byte (Byte byte) { - if ( ( byte & 0x0f ) <= 9 ) - return ( byte & 0x0f ) + '0'; + if ( ( byte & 0x0f) <= 9 ) + return ( byte & 0x0f) + '0'; else - return ( byte & 0x0f ) - 10 + 'a'; + return ( byte & 0x0f) - 10 + 'a'; } /** Convert an integer to a string @@ -188,12 +188,12 @@ String_convert::nibble2hex_byte( Byte byte ) #fmt# is a printf style format, default assumes "%d" as format. */ String -String_convert::int_str(int i, char const* fmt) +String_convert::int_str (int i, char const* fmt) { char buffer[STRING_BUFFER_LEN]; - snprintf(buffer, STRING_BUFFER_LEN, - (fmt ? fmt : "%d"), i ); // assume radix 10 - return String(buffer); + snprintf (buffer, STRING_BUFFER_LEN, + (fmt ? fmt : "%d"), i); // assume radix 10 + return String (buffer); } /** @@ -202,12 +202,12 @@ String_convert::int_str(int i, char const* fmt) @param #fmt# is a printf style format, default assumes "%lf" as format */ String -String_convert::double_str(double f, char const* fmt) +String_convert::double_str (double f, char const* fmt) { char buf[STRING_BUFFER_LEN]; - snprintf(buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f); - return String(buf); + snprintf (buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f); + return String (buf); } /** @@ -217,25 +217,25 @@ String_convert::double_str(double f, char const* fmt) #n# is a repetition count, default value is 1 */ String -String_convert::char_str(char c, int n) +String_convert::char_str (char c, int n) { n = n >= 0 ? n : 0; char* ch_p = new char[ n ]; - memset( ch_p, c, n ); - String s((Byte*)ch_p, n); + memset (ch_p, c, n); + String s ((Byte*)ch_p, n); delete ch_p; return s; } String -String_convert::rational_str(Rational r) +String_convert::rational_str (Rational r) { - char * n = Itoa(r.numerator()); // LEAK???? + char * n = Itoa (r.numerator()); // LEAK???? String s = n; if (r.denominator() != 1) { - char * d = Itoa(r.denominator()); - s += String( '/' ) + String(d); + char * d = Itoa (r.denominator()); + s += String ('/') + String (d); //delete d; } /* delete n; @@ -244,9 +244,9 @@ String_convert::rational_str(Rational r) } String -String_convert::pointer_str(void const *l) +String_convert::pointer_str (void const *l) { char buffer[STRING_BUFFER_LEN]; - snprintf(buffer, STRING_BUFFER_LEN, "%p", l ); // assume radix 10 - return String(buffer); + snprintf (buffer, STRING_BUFFER_LEN, "%p", l); // assume radix 10 + return String (buffer); } diff --git a/flower/string.cc b/flower/string.cc index d66951c931..1bd236114c 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -17,7 +17,7 @@ #include "string-convert.hh" #ifdef STRING_DEBUG -void* mymemmove( void* dest, void const* src, size_t n ); +void* mymemmove (void* dest, void const* src, size_t n); #define memmove mymemmove #endif @@ -27,16 +27,16 @@ String::copy_byte_p() const { Byte const* src = strh_.byte_C(); Byte* dest = new Byte[strh_.length_i() + 1]; - memcpy( dest, src, strh_.length_i() + 1 ); + memcpy (dest, src, strh_.length_i() + 1); return dest; } void -String::print_on(ostream& os) const +String::print_on (ostream& os) const { if (!strh_.is_binary_bo()) os << ch_C(); else - for ( int i = 0; i < length_i(); i++ ) + for ( int i = 0; i < length_i(); i++) os << (Byte)(*this)[ i ]; } @@ -44,24 +44,24 @@ String::print_on(ostream& os) const copying, constructing. */ String& -String::operator = (String const&source ) +String::operator = (String const&source) { strh_ = source.strh_; return *this; } -String::String(Rational r) +String::String (Rational r) { - *this = String_convert::rational_str(r); + *this = String_convert::rational_str (r); } String::String (double f, char const* fmt) { - *this= String_convert::double_str(f,fmt); + *this= String_convert::double_str (f,fmt); } -String::String( char c, int n ) +String::String (char c, int n) { *this = String_convert::char_str (c,n); } @@ -70,40 +70,40 @@ String::String( char c, int n ) @see String_convert::int_str */ -String::String(int i, char const * format ) +String::String (int i, char const * format) { - *this = String_convert::int_str(i,format); + *this = String_convert::int_str (i,format); } String::String (bool b) { - *this = (char const* ) (b ? "true" : "false"); + *this = (char const*) (b ? "true" : "false"); } -String::String( char const* source ) +String::String (char const* source) { - assert(source); + assert (source); strh_ = source; } -String::String( Byte const* byte_l, int length_i ) +String::String (Byte const* byte_l, int length_i) { - strh_.set( byte_l, length_i ); + strh_.set (byte_l, length_i); } void -String::append(String s) +String::append (String s) { - strh_.append( s.byte_C(), s.length_i() ); + strh_.append (s.byte_C(), s.length_i()); } void String::operator +=(String s) { - append(s); + append (s); } void -String::prepend(String s) +String::prepend (String s) { s += *this; *this = s; @@ -143,50 +143,50 @@ String::ch_l() Do a signed comparison, analogous to memcmp; */ int -String::compare_i(String const& s1, String const& s2 ) +String::compare_i (String const& s1, String const& s2) { Byte const* p1 = s1.byte_C(); Byte const* p2 = s2.byte_C(); - if ( p1 == p2 ) + if ( p1 == p2) return 0; int i1 = s1.length_i(); int i2 = s2.length_i(); - int result= memcmp( p1, p2, i1 = 0 ) { + while (next_i >= 0) { index_i += next_i; - next_i = right_str( length_i() - index_i - length ).index_i( string ); + next_i = right_str (length_i() - index_i - length).index_i (string ); } return index_i; } @@ -197,14 +197,14 @@ String::index_last_i( char const* string ) const // UGK! the index of the leftmost character #c# (0 <= return < length_i()), or -1 if not found. - ? should return length_i()?, as in string.left_str(index_i(delimiter)) + ? should return length_i()?, as in string.left_str (index_i (delimiter)) */ int -String::index_i(char c ) const +String::index_i (char c) const { char const* me = strh_.ch_C(); - char const* p = (char const *) memchr( me,c, length_i()); - if ( p ) + char const* p = (char const *) memchr (me,c, length_i()); + if ( p) return p - me; return -1; } @@ -216,13 +216,13 @@ String::index_i(char c ) const index of leftmost occurrence of #searchfor# */ int -String::index_i( String searchfor ) const +String::index_i (String searchfor) const { char const* me = strh_.ch_C(); - char const* p = (char const *) memmem( - me, length_i(), searchfor.ch_C(), searchfor.length_i()); + char const* p = (char const *) memmem ( + me, length_i(), searchfor.ch_C(), searchfor.length_i ()); - if ( p ) + if ( p) return p - me; else return -1; @@ -234,15 +234,15 @@ String::index_i( String searchfor ) const the index of the leftmost occurance of an element of #set# */ int -String::index_any_i( String set ) const +String::index_any_i (String set) const { int n = length_i(); - if ( !n ) + if ( !n) return -1; void const * me_l = (void const *) strh_.ch_C(); for (int i=0; i < set.length_i(); i++) { - char * found=(char*) memchr(me_l, set[i], n ); + char * found=(char*) memchr (me_l, set[i], n ); if (found) { return found - me_l; } @@ -251,7 +251,7 @@ String::index_any_i( String set ) const } String -String::left_str( int n ) const +String::left_str (int n) const { if (n >= length_i()) return *this; @@ -261,12 +261,12 @@ String::left_str( int n ) const return retval; retval = *this; - retval.strh_.trunc(n); + retval.strh_.trunc (n); return retval; } String -String::right_str( int n ) const +String::right_str (int n) const { if (n > length_i()) return *this; @@ -274,14 +274,14 @@ String::right_str( int n ) const if ( n < 1) return ""; - return String( strh_.byte_C() + length_i() - n, n ); + return String (strh_.byte_C() + length_i() - n, n); } String -String::nomid_str( int index_i, int n ) const +String::nomid_str (int index_i, int n) const { - if ( index_i < 0 ) { + if ( index_i < 0) { n += index_i; index_i = 0; } @@ -289,28 +289,28 @@ String::nomid_str( int index_i, int n ) const return *this; return - left_str( index_i ) + - right_str( length_i() - index_i - n ) ; + left_str (index_i) + + right_str (length_i() - index_i - n) ; } /* proposal: change to "cut()" */ String -String::mid_str( int index_i, int n ) const +String::mid_str (int index_i, int n) const { if (index_i <0) { n += index_i; index_i=0; } - if ( !length_i() || ( index_i < 0 ) || ( index_i >= length_i() ) || ( n < 1 ) ) + if ( !length_i() || ( index_i < 0) || ( index_i >= length_i () ) || ( n < 1 ) ) return String(); - if ( ( n > length_i() ) || ( index_i + n > length_i() ) ) + if ( ( n > length_i()) || ( index_i + n > length_i () ) ) n = length_i() - index_i; - return String( byte_C() + index_i, n ); + return String (byte_C() + index_i, n); } String @@ -324,14 +324,14 @@ void String::to_upper() { char *s = (char*)strh_.byte_l(); - strnupr( s ,length_i()); + strnupr (s ,length_i()); } void String::to_lower() { char* s = strh_.ch_l(); - strnlwr(s,length_i()); + strnlwr (s,length_i()); } @@ -346,20 +346,20 @@ String String::reversed_str() const { String str = *this; - strrev( str.byte_l(), str.length_i() ); + strrev (str.byte_l(), str.length_i ()); return str; } int String::value_i() const { - return String_convert::dec2_i( *this ); + return String_convert::dec2_i (*this); } double String::value_f() const { - return String_convert::dec2_f( *this ); + return String_convert::dec2_f (*this); } diff --git a/flower/stringtest.cc b/flower/stringtest.cc index 0bbde77c99..b415de36e2 100644 --- a/flower/stringtest.cc +++ b/flower/stringtest.cc @@ -13,11 +13,11 @@ ctors() { cout << "constructors"< a; - a.push("abcd"); - a.push("zxy"); - a.push("abc"); - a.push(""); - a.sort(String::compare_i); + a.push ("abcd"); + a.push ("zxy"); + a.push ("abc"); + a.push (""); + a.sort (String::compare_i); cout << "compares: "< #include void* -mymemmove( void* dest, void const* src, size_t n ) +mymemmove (void* dest, void const* src, size_t n) { - return memcpy( dest, src, n ); // wohltempererit: 69006 + return memcpy (dest, src, n); // wohltempererit: 69006 } #define memmove mymemmove #endif diff --git a/flower/text-db.cc b/flower/text-db.cc index ebfc992ff2..3624d46ff7 100644 --- a/flower/text-db.cc +++ b/flower/text-db.cc @@ -28,20 +28,20 @@ Text_db::get_record() while (1) { String s; Array fields; - assert(!eof()); + assert (!eof()); while ((s = get_word()) != "") { - fields.push(s); + fields.push (s); gobble_white(); } if (get_line() != "") - assert(false); + assert (false); assert (fields.size()); - return Text_record(fields, get_name(), line()); + return Text_record (fields, get_name(), line ()); } } diff --git a/flower/text-stream.cc b/flower/text-stream.cc index a2d3e4b119..a8eb695ea2 100644 --- a/flower/text-stream.cc +++ b/flower/text-stream.cc @@ -1,6 +1,6 @@ #include "text-stream.hh" -Text_stream::Text_stream(String fn) +Text_stream::Text_stream (String fn) { ios::sync_with_stdio(); if (fn == "") @@ -12,20 +12,20 @@ Text_stream::Text_stream(String fn) else { name = fn; - f = fopen(fn, "r"); + f = fopen (fn, "r"); } if (!f) { cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n"; - exit(1); + exit (1); } line_no = 1; } void -Text_stream::message(String s) +Text_stream::message (String s) { - cerr << "\n"< d) - : dat(d) +Vector::Vector (Array d) + : dat (d) { } -Vector::Vector(Vector const &n) - : dat(n.dat) +Vector::Vector (Vector const &n) + : dat (n.dat) { } Vector Vector::operator-() const { - Vector v(*this); + Vector v (*this); v*=-1; return v; } void -Vector::set_unit(int j) +Vector::set_unit (int j) { - fill(0.0); + fill (0.0); dat[j] = 1.0; } diff --git a/lily/include/audio-column.hh b/lily/include/audio-column.hh index c3d353615e..b5f09403f8 100644 --- a/lily/include/audio-column.hh +++ b/lily/include/audio-column.hh @@ -19,9 +19,9 @@ class Audio_column { public: - Audio_column( Moment at_mom ); + Audio_column (Moment at_mom); - void add( Audio_item* i_l ); + void add (Audio_item* i_l); Moment at_mom() const; void print() const; @@ -29,7 +29,7 @@ public: Audio_score * audio_score_l_; private: - Audio_column( Audio_column const& ); + Audio_column (Audio_column const&); Moment at_mom_; }; diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index 1b0a4fccf9..61c24d3a49 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -23,7 +23,7 @@ virtual CSound_item* score_item_p() = 0; */ struct Audio_item : public Audio_element { - Audio_item( Request* req_l ); + Audio_item (Request* req_l); /// Create a midi-item from myself. virtual Midi_item* midi_item_p() = 0; @@ -34,24 +34,24 @@ struct Audio_item : public Audio_element { DECLARE_MY_RUNTIME_TYPEINFO; private: - Audio_item( Audio_item const& ); - Audio_item& operator=( Audio_item const& ); + Audio_item (Audio_item const&); + Audio_item& operator=( Audio_item const&); }; struct Audio_key : public Audio_item { - Audio_key( Request* req_l ); + Audio_key (Request* req_l); virtual Midi_item* midi_item_p(); }; struct Audio_instrument : public Audio_item { - Audio_instrument( String instrument_str ); + Audio_instrument (String instrument_str); virtual Midi_item* midi_item_p(); String str_; }; struct Audio_note : public Audio_item { - Audio_note( Request* req_l ); + Audio_note (Request* req_l); virtual Midi_item* midi_item_p(); }; @@ -61,7 +61,7 @@ struct Audio_text : Audio_item { MARKER, CUE_POINT }; - Audio_text( Audio_text::Type type, String text_str ); + Audio_text (Audio_text::Type type, String text_str); virtual Midi_item* midi_item_p(); Type type_; @@ -69,14 +69,14 @@ struct Audio_text : Audio_item { }; struct Audio_tempo : Audio_item { - Audio_tempo( int per_minute_4_i ); + Audio_tempo (int per_minute_4_i); virtual Midi_item* midi_item_p(); int per_minute_4_i_; }; struct Audio_meter : Audio_item { - Audio_meter( Request* req_l ); + Audio_meter (Request* req_l); virtual Midi_item* midi_item_p(); }; diff --git a/lily/include/audio-score.hh b/lily/include/audio-score.hh index 407a7b412d..5fad1355f2 100644 --- a/lily/include/audio-score.hh +++ b/lily/include/audio-score.hh @@ -17,15 +17,15 @@ class Audio_score { public: - Audio_score( Score* l ); + Audio_score (Score* l); - void add( Audio_column* ); - void add_staff( Audio_staff* l ); - void add(Audio_element*p); + void add (Audio_column*); + void add_staff (Audio_staff* l); + void add (Audio_element*p); - void output( Midi_stream& midi_stream_r ); - void output_header_track( Midi_stream& midi_stream_r ); + void output (Midi_stream& midi_stream_r); + void output_header_track (Midi_stream& midi_stream_r); void print() const; void process(); diff --git a/lily/include/audio-staff.hh b/lily/include/audio-staff.hh index 7e91d7fd0b..430c5f2c8a 100644 --- a/lily/include/audio-staff.hh +++ b/lily/include/audio-staff.hh @@ -13,8 +13,8 @@ #include "audio-element.hh" struct Audio_staff : public Audio_element { - void add( Audio_item* l); - void output( Midi_stream& midi_stream_r, int track_i ); + void add (Audio_item* l); + void output (Midi_stream& midi_stream_r, int track_i); Link_list audio_item_l_list_; DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/axes.hh b/lily/include/axes.hh index 7dfe8fbf7a..a9dbb3c5e1 100644 --- a/lily/include/axes.hh +++ b/lily/include/axes.hh @@ -19,6 +19,6 @@ enum Axis { class String; -String axis_name_str(Axis); +String axis_name_str (Axis); #endif // AXES_HH diff --git a/lily/include/axis-group.hh b/lily/include/axis-group.hh index bdf758cb42..92d0cd8806 100644 --- a/lily/include/axis-group.hh +++ b/lily/include/axis-group.hh @@ -21,15 +21,15 @@ axis-group.hh -- declare Axis_group_administration, Axis_group_element struct Axis_group_administration { Link_array elem_l_arr_; - Interval extent(Axis)const; + Interval extent (Axis)const; void print() const ; - Axis_group_administration(Axis_group_administration const&); + Axis_group_administration (Axis_group_administration const&); Axis_group_administration(){} - void remove_all(Axis a1,Axis a2); + void remove_all (Axis a1,Axis a2); - bool contains_b(Score_elem const *)const; - void add_element(Score_elem*, Axis_group_element*, Axis a1, Axis a2); - void remove_element(Score_elem*, Axis a1, Axis a2); + bool contains_b (Score_elem const *)const; + void add_element (Score_elem*, Axis_group_element*, Axis a1, Axis a2); + void remove_element (Score_elem*, Axis a1, Axis a2); }; /** @@ -45,9 +45,9 @@ protected: public: virtual void remove_all()=0; - virtual void add_element(Score_elem*)=0; - virtual void remove_element(Score_elem*)=0; - virtual bool contains_b(Score_elem const *)const; + virtual void add_element (Score_elem*)=0; + virtual void remove_element (Score_elem*)=0; + virtual bool contains_b (Score_elem const *)const; DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // Axis_group_administration_HH diff --git a/lily/include/bar-column-grav.hh b/lily/include/bar-column-grav.hh index 70b7bcf63a..d7d8ba2c43 100644 --- a/lily/include/bar-column-grav.hh +++ b/lily/include/bar-column-grav.hh @@ -20,7 +20,7 @@ class Bar_column_engraver :public Engraver { Bar *bar_l_; protected: - virtual void acknowledge_element(Score_elem_info); + virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); public: diff --git a/lily/include/bar-column.hh b/lily/include/bar-column.hh index 7c7fb426ad..43fac9672d 100644 --- a/lily/include/bar-column.hh +++ b/lily/include/bar-column.hh @@ -20,10 +20,10 @@ class Bar_column : public Script_column { public: Bar_column(); - void set_bar( Bar*); + void set_bar (Bar*); protected: SCORE_ELEM_CLONE(Bar_column); - void do_substitute_dependency(Score_elem*,Score_elem*); + void do_substitute_dependency (Score_elem*,Score_elem*); DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/bar-grav.hh b/lily/include/bar-grav.hh index f159d2973a..bb7cfb061b 100644 --- a/lily/include/bar-grav.hh +++ b/lily/include/bar-grav.hh @@ -23,7 +23,7 @@ public: protected: - virtual bool do_try_request(Request *req_l); + virtual bool do_try_request (Request *req_l); virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); diff --git a/lily/include/bar-number-grav.hh b/lily/include/bar-number-grav.hh index 287706b6ee..ad1956648a 100644 --- a/lily/include/bar-number-grav.hh +++ b/lily/include/bar-number-grav.hh @@ -20,7 +20,7 @@ class Bar_number_grav : public Engraver { int number_i_; protected: - void acknowledge_element(Score_elem_info); + void acknowledge_element (Score_elem_info); void do_pre_move_processing(); public: Bar_number_grav(); diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 1e6a36fe15..48b4f9bb4c 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -26,9 +26,9 @@ public: /* *************** */ DECLARE_MY_RUNTIME_TYPEINFO; Beam(); - void add(Stem*); + void add (Stem*); - void set_grouping(Rhythmic_grouping def, Rhythmic_grouping current); + void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current); void set_stemlens(); SCORE_ELEM_CLONE(Beam); protected: @@ -37,12 +37,12 @@ protected: virtual void set_default_dir(); virtual void do_pre_processing(); virtual void do_post_processing(); - virtual void do_substitute_dependent(Score_elem*, Score_elem*); + virtual void do_substitute_dependent (Score_elem*, Score_elem*); virtual void do_print() const; private: - Molecule stem_beams(Stem *here, Stem *next, Stem *prev)const; + Molecule stem_beams (Stem *here, Stem *next, Stem *prev)const; void solve_slope(); Molecule*brew_molecule_p()const; }; diff --git a/lily/include/boxes.hh b/lily/include/boxes.hh index 8161a84518..36db4b88ba 100644 --- a/lily/include/boxes.hh +++ b/lily/include/boxes.hh @@ -18,22 +18,22 @@ struct Box { Interval &y(){ return interval_a_[Y_AXIS]; } Interval x()const{ return interval_a_[X_AXIS]; } Interval y()const{return interval_a_[Y_AXIS]; } - Interval operator[](Axis a ) { + Interval operator[](Axis a) { return interval_a_[a]; } - void translate(Offset o) { - x().translate(o.x()); - y().translate(o.y()); + void translate (Offset o) { + x().translate (o.x ()); + y().translate (o.y ()); } /// smallest box enclosing #b# - void unite(Box b) { - x().unite(b.x()); - y().unite(b.y()); + void unite (Box b) { + x().unite (b.x ()); + y().unite (b.y ()); } Box(); - Box(Interval ix, Interval iy); + Box (Interval ix, Interval iy); }; diff --git a/lily/include/break.hh b/lily/include/break.hh index 0a9fafe68c..000ef3ec92 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -23,7 +23,7 @@ struct Col_stats int cols_i_; Col_stats(); - void add(Line_of_cols const&l); + void add (Line_of_cols const&l); String str()const; }; @@ -47,16 +47,16 @@ protected: /// helper: solve for the columns in #curline#. - void solve_line(Col_hpositions*) const; + void solve_line (Col_hpositions*) const; /// helper: approximate the energyv - void approximate_solve_line(Col_hpositions*) const; + void approximate_solve_line (Col_hpositions*) const; /// does curline fit on the paper? - bool feasible(Line_of_cols)const; + bool feasible (Line_of_cols)const; - Line_spacer* generate_spacing_problem(Line_of_cols)const; + Line_spacer* generate_spacing_problem (Line_of_cols)const; virtual Array do_solve()const=0; void print_stats()const; @@ -69,7 +69,7 @@ public: Line_spacer* (*get_line_spacer)(); Break_algorithm(); - void set_pscore(Paper_score*); + void set_pscore (Paper_score*); /// check if the spacing/breaking problem is well-stated void problem_OK()const; diff --git a/lily/include/clef-grav.hh b/lily/include/clef-grav.hh index 2f974eeadb..624e7bdf20 100644 --- a/lily/include/clef-grav.hh +++ b/lily/include/clef-grav.hh @@ -16,17 +16,17 @@ class Clef_engraver : public Engraver { Clef_item *clef_p_; Clef_change_req * clef_req_l_; void create_clef(); - void read_req(Clef_change_req*); - bool set_type(String); + void read_req (Clef_change_req*); + bool set_type (String); protected: virtual void do_process_requests(); - virtual void fill_staff_info(Staff_info&); + virtual void fill_staff_info (Staff_info&); virtual void do_pre_move_processing(); virtual void do_removal_processing(); virtual void do_creation_processing(); virtual void do_post_move_processing(); - virtual bool do_try_request(Request*); - virtual void acknowledge_element(Score_elem_info); + virtual bool do_try_request (Request*); + virtual void acknowledge_element (Score_elem_info); public: int c0_position_i_; String clef_type_str_; diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index face7e818d..ad8a674242 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -30,8 +30,8 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Clef_item); Clef_item(); - void read(Clef_engraver const&); - void read(String); + void read (Clef_engraver const&); + void read (String); }; #endif // CLEFITEM_HH diff --git a/lily/include/col-info.hh b/lily/include/col-info.hh index 985df3b69d..36a2f73f72 100644 --- a/lily/include/col-info.hh +++ b/lily/include/col-info.hh @@ -24,7 +24,7 @@ struct Colinfo { bool ugh_b_; /* *************** */ Colinfo(); - Colinfo(PCol *,Real const *); + Colinfo (PCol *,Real const *); void print() const; bool fixed() const { return fixpos_p_.get_C();} diff --git a/lily/include/colhpos.hh b/lily/include/colhpos.hh index a8891ea004..3f198f2ca1 100644 --- a/lily/include/colhpos.hh +++ b/lily/include/colhpos.hh @@ -30,7 +30,7 @@ struct Col_hpositions { constraints. should always work */ void stupid_solution(); Col_hpositions(); - void add( PCol*c); + void add (PCol*c); void print() const; }; diff --git a/lily/include/collision-grav.hh b/lily/include/collision-grav.hh index be3880de62..b04d9fe746 100644 --- a/lily/include/collision-grav.hh +++ b/lily/include/collision-grav.hh @@ -16,7 +16,7 @@ class Collision_engraver : public Engraver { Collision* col_p_; protected: - virtual void acknowledge_element(Score_elem_info); + virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing(); public: Collision_engraver(); diff --git a/lily/include/collision.hh b/lily/include/collision.hh index 162c5fe385..6ab5db3fad 100644 --- a/lily/include/collision.hh +++ b/lily/include/collision.hh @@ -22,7 +22,7 @@ */ class Collision : public Horizontal_vertical_group_item { protected: - virtual void do_substitute_dependency(Score_elem*,Score_elem*); + virtual void do_substitute_dependency (Score_elem*,Score_elem*); virtual void do_pre_processing(); public: Link_array clash_l_arr_; diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 5d173ca9f9..1a78f14d75 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -65,16 +65,16 @@ public: Tempo_req(); REQUESTMETHODS(Tempo_req, tempo); - bool do_equal_b(Request *)const; + bool do_equal_b (Request *)const; }; class Partial_measure_req : public Timing_req { public: Moment duration_; - Partial_measure_req(Moment); + Partial_measure_req (Moment); REQUESTMETHODS(Partial_measure_req, partial); - bool do_equal_b(Request*)const; + bool do_equal_b (Request*)const; }; /** @@ -85,8 +85,8 @@ public: int beats_i_, one_beat_i_; Meter_change_req(); - void set(int,int); - bool do_equal_b(Request*)const; + void set (int,int); + bool do_equal_b (Request*)const; REQUESTMETHODS(Meter_change_req, meterchange); }; @@ -95,15 +95,15 @@ class Cadenza_req : public Timing_req { public: /// turn on? bool on_b_; - bool do_equal_b(Request*)const; - Cadenza_req(bool); + bool do_equal_b (Request*)const; + Cadenza_req (bool); REQUESTMETHODS(Cadenza_req,cadenza); }; /// check if we're at start of a measure. class Barcheck_req : public Timing_req { public: - bool do_equal_b(Request *)const; + bool do_equal_b (Request *)const; REQUESTMETHODS(Barcheck_req,barcheck); }; @@ -111,7 +111,7 @@ class Measure_grouping_req : public Timing_req { public: Array beat_i_arr_; Array elt_length_arr_; - bool do_equal_b(Request *)const; + bool do_equal_b (Request *)const; REQUESTMETHODS(Measure_grouping_req, measuregrouping); }; @@ -120,8 +120,8 @@ public: class Bar_req : public Command_req { public: String type_str_; - Bar_req(String); - bool do_equal_b(Request*)const; + Bar_req (String); + bool do_equal_b (Request*)const; REQUESTMETHODS(Bar_req,bar); }; @@ -148,7 +148,7 @@ public: /// don't ignore the octaves in #melodic_p_arr_#? bool multi_octave_b_; Key_change_req(); - Key_change_req(Key_change_req const&); + Key_change_req (Key_change_req const&); ~Key_change_req(); REQUESTMETHODS(Key_change_req, keychange); @@ -160,7 +160,7 @@ public: /// return number of sharps in key int sharps_i(); - void transpose(Melodic_req const & d) const; + void transpose (Melodic_req const & d) const; /// is minor key? int minor_b(); }; @@ -168,7 +168,7 @@ public: class Clef_change_req : public Command_req { public: String clef_str_; - Clef_change_req(String); + Clef_change_req (String); REQUESTMETHODS(Clef_change_req, clefchange); }; diff --git a/lily/include/dimen.hh b/lily/include/dimen.hh index 71b0036b72..ac8267f187 100644 --- a/lily/include/dimen.hh +++ b/lily/include/dimen.hh @@ -14,8 +14,8 @@ const Real PT_TO_PT =1.0; #define CM *CM_TO_PT #define INCH *INCH_TO_PT -Real parse_dimen(String); -String print_dimen(Real); -Real convert_dimen(Real, String); +Real parse_dimen (String); +String print_dimen (Real); +Real convert_dimen (Real, String); #endif diff --git a/lily/include/dynamic-grav.hh b/lily/include/dynamic-grav.hh index 389a468466..26556edf9d 100644 --- a/lily/include/dynamic-grav.hh +++ b/lily/include/dynamic-grav.hh @@ -25,12 +25,12 @@ public: ~Dynamic_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual void acknowledge_element(Score_elem_info); - virtual bool do_try_request(Request *req_l); + virtual void acknowledge_element (Score_elem_info); + virtual bool do_try_request (Request *req_l); virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); - virtual void set_feature(Feature); + virtual void set_feature (Feature); }; #endif // DYNAMIC_GRAV_HH diff --git a/lily/include/elem-group-item.hh b/lily/include/elem-group-item.hh index b1248cc990..8e0fcd5154 100644 --- a/lily/include/elem-group-item.hh +++ b/lily/include/elem-group-item.hh @@ -20,10 +20,10 @@ class Horizontal_vertical_group_item : public Axis_group_item, public Horizontal_vertical_group_element { protected: virtual void do_print() const; - virtual void remove_all() { Horizontal_vertical_group_element::remove_all(); } + virtual void remove_all() { Horizontal_vertical_group_element::remove_all (); } public: - virtual void add_element(Score_elem*e) { Horizontal_vertical_group_element::add_element(e); } - virtual void remove_element(Score_elem*e) { Horizontal_vertical_group_element::remove_element(e); } + virtual void add_element (Score_elem*e) { Horizontal_vertical_group_element::add_element (e); } + virtual void remove_element (Score_elem*e) { Horizontal_vertical_group_element::remove_element (e); } DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_vertical_group_item); diff --git a/lily/include/elem-group.hh b/lily/include/elem-group.hh index baf3010c09..61ad7519f3 100644 --- a/lily/include/elem-group.hh +++ b/lily/include/elem-group.hh @@ -26,8 +26,8 @@ protected: public: DECLARE_MY_RUNTIME_TYPEINFO; - virtual void add_element(Score_elem*); - virtual void remove_element(Score_elem*); + virtual void add_element (Score_elem*); + virtual void remove_element (Score_elem*); }; /** @@ -39,8 +39,8 @@ protected: virtual void remove_all(); public: - virtual void add_element(Score_elem*); - virtual void remove_element(Score_elem*); + virtual void add_element (Score_elem*); + virtual void remove_element (Score_elem*); DECLARE_MY_RUNTIME_TYPEINFO; }; @@ -54,8 +54,8 @@ class Horizontal_vertical_group_element : public Vertical_group_element, protected: virtual void remove_all(); public: - virtual void add_element(Score_elem*); - virtual void remove_element(Score_elem*); + virtual void add_element (Score_elem*); + virtual void remove_element (Score_elem*); DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/engraver-group.hh b/lily/include/engraver-group.hh index 2e3e4941bd..03e26c9610 100644 --- a/lily/include/engraver-group.hh +++ b/lily/include/engraver-group.hh @@ -33,7 +33,7 @@ protected: virtual void do_print()const; virtual bool removable_b()const; public: - Engraver*get_simple_engraver(char const*typeinfo)const; + Engraver*get_simple_engraver (char const*typeinfo)const; virtual void print() const ; Input_translator * itrans_l_; @@ -49,7 +49,7 @@ public: Pre: #grav_l# is in #grav_list_# */ - virtual void terminate_engraver(Engraver * grav_l); + virtual void terminate_engraver (Engraver * grav_l); DECLARE_MY_RUNTIME_TYPEINFO; @@ -57,31 +57,31 @@ public: /** Remove #grav_l# from the list, and return it. */ - virtual Engraver * remove_engraver_p(Engraver*grav_l); - virtual void set_feature(Feature i); + virtual Engraver * remove_engraver_p (Engraver*grav_l); + virtual void set_feature (Feature i); virtual void sync_features(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); virtual void do_removal_processing(); - virtual bool do_try_request(Request*); - virtual bool try_request(Request*); + virtual bool do_try_request (Request*); + virtual bool try_request (Request*); virtual void do_process_requests(); virtual Staff_info get_staff_info()const; - virtual Engraver_group_engraver * find_engraver_l(String name,String id); + virtual Engraver_group_engraver * find_engraver_l (String name,String id); virtual void do_announces(); - virtual void announce_element(Score_elem_info); - virtual void add(Engraver* grav_p); - virtual bool contains_b(Engraver*)const; + virtual void announce_element (Score_elem_info); + virtual void add (Engraver* grav_p); + virtual bool contains_b (Engraver*)const; - virtual Translator* find_get_translator_l(String name, String id); + virtual Translator* find_get_translator_l (String name, String id); virtual Translator * get_default_interpreter(); /** Go up in the tree. default: choose next parent */ - Translator * ancestor_l(int l=1); + Translator * ancestor_l (int l=1); int depth_i() const; }; diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index 60b8b95ca1..a750704437 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -31,7 +31,7 @@ class Engraver { /** You cannot copy a Engraver */ - Engraver(const Engraver&){} + Engraver (const Engraver&){} enum { VIRGIN, @@ -61,13 +61,13 @@ protected: virtual void do_post_move_processing(){} - virtual void do_creation_processing () {} + virtual void do_creation_processing() {} virtual void do_removal_processing() {} /** Invoke walker method to typeset element. Default: pass on to daddy. */ - virtual void typeset_element(Score_elem*elem_p); + virtual void typeset_element (Score_elem*elem_p); /** take note of item/spanner @@ -75,31 +75,31 @@ protected: Default: ignore the info */ - virtual void acknowledge_element(Score_elem_info) {} + virtual void acknowledge_element (Score_elem_info) {} /** Announce element. Default: pass on to daddy. Utility */ - virtual void announce_element(Score_elem_info); + virtual void announce_element (Score_elem_info); /** - Set Feature of the engraver(s). Default: ignore Feature. + Set Feature of the engraver (s). Default: ignore Feature. */ - virtual void set_feature(Feature){} + virtual void set_feature (Feature){} /** ask daddy for a feature */ - virtual Scalar get_feature(String type_str); + virtual Scalar get_feature (String type_str); /** Does this equal or contain a certain engraver? */ virtual void sync_features() {} - virtual bool contains_b(Engraver*grav_l)const; + virtual bool contains_b (Engraver*grav_l)const; /** Get information on the staff. Default: ask daddy. */ virtual Staff_info get_staff_info()const; - virtual void fill_staff_info(Staff_info&); + virtual void fill_staff_info (Staff_info&); virtual void do_print()const; @@ -107,7 +107,7 @@ protected: @see{try_request} Default: always return false */ - virtual bool do_try_request(Request *req_l); + virtual bool do_try_request (Request *req_l); public: void pre_move_processing(); void process_requests(); @@ -120,7 +120,7 @@ public: true: request swallowed. Don't try to put the request elsewhere. */ - bool try_request(Request*); + bool try_request (Request*); bool is_bottom_engraver() const; void post_move_processing(); @@ -139,17 +139,17 @@ public: */ #define ADD_THIS_ENGRAVER(c) \ struct c ## init { \ - static Engraver * globalctor (){ \ + static Engraver * globalctor(){ \ return new c; \ } \ - c ## init () { \ - add_engraver(c::static_name(), globalctor); \ + c ## init() { \ + add_engraver (c::static_name(), globalctor); \ \ } \ } _ ## c ## init; typedef Engraver*(*Grav_ctor)(void); -void add_engraver(String s, Grav_ctor f); +void add_engraver (String s, Grav_ctor f); #endif // ENGRAVER_HH diff --git a/lily/include/general-script-def.hh b/lily/include/general-script-def.hh index c384d4fa10..4f927b2dfd 100644 --- a/lily/include/general-script-def.hh +++ b/lily/include/general-script-def.hh @@ -25,12 +25,12 @@ public: virtual int rel_stem_dir_i()const; virtual int priority_i()const; virtual bool inside_b()const; - virtual Atom get_atom(Paper_def* p, int dir_i_)const; - bool equal_b(General_script_def const&)const; + virtual Atom get_atom (Paper_def* p, int dir_i_)const; + bool equal_b (General_script_def const&)const; virtual ~General_script_def() {} protected: - virtual bool do_equal_b(General_script_def const *)const; + virtual bool do_equal_b (General_script_def const *)const; virtual void do_print()const; }; diff --git a/lily/include/global-performers.hh b/lily/include/global-performers.hh index b3e65743d9..0ed76e4c54 100644 --- a/lily/include/global-performers.hh +++ b/lily/include/global-performers.hh @@ -14,20 +14,20 @@ /** A macro to automate administration of performers */ -#define ADD_THIS_PERFORMER( c ) \ +#define ADD_THIS_PERFORMER( c) \ struct c ## init { \ - static Performer* globalctor () \ + static Performer* globalctor() \ { \ return new c;\ } \ - c ## init () \ + c ## init() \ { \ - add_Performer( c::static_name(), globalctor ); \ + add_Performer (c::static_name(), globalctor); \ } \ } _ ## c ## init; // typedef Performer*(*Perf_ctor)(void); c++ ? typedef Performer*(*Perf_ctor)(); -void add_Performer(String s, Perf_ctor f); +void add_Performer (String s, Perf_ctor f); #endif // GLOBAL_PERFORMER_HH diff --git a/lily/include/global-translator.hh b/lily/include/global-translator.hh index 112392a670..25f5968714 100644 --- a/lily/include/global-translator.hh +++ b/lily/include/global-translator.hh @@ -21,11 +21,11 @@ public: Global_translator(); int moments_left_i()const; - void modify_next(Moment&); - void add_moment_to_process(Moment); + void modify_next (Moment&); + void add_moment_to_process (Moment); - virtual void set_score(Score*); - virtual void prepare(Moment); + virtual void set_score (Score*); + virtual void prepare (Moment); virtual void process() {} virtual void finish() {} virtual void start() {} @@ -35,7 +35,7 @@ protected: virtual Global_translator *global_l() { return this; } virtual int depth_i() const; - virtual Translator *ancestor_l(int); + virtual Translator *ancestor_l (int); }; diff --git a/lily/include/grouping.hh b/lily/include/grouping.hh index 583f5d4529..13fcbd790a 100644 --- a/lily/include/grouping.hh +++ b/lily/include/grouping.hh @@ -23,39 +23,39 @@ struct Rhythmic_grouping { Array intervals(); MInterval interval()const; Moment length() const; - void intersect(MInterval); + void intersect (MInterval); void operator=(Rhythmic_grouping const&); - Rhythmic_grouping(Rhythmic_grouping const&); - Rhythmic_grouping(MInterval, int n=1); + Rhythmic_grouping (Rhythmic_grouping const&); + Rhythmic_grouping (MInterval, int n=1); Rhythmic_grouping(); - Rhythmic_grouping(Array); + Rhythmic_grouping (Array); ~Rhythmic_grouping(); - void add_child(Moment start, Moment len); - bool child_fit_b(Moment start); - void split(Rhythmic_grouping r); - void split(Array); - void split(int n); + void add_child (Moment start, Moment len); + bool child_fit_b (Moment start); + void split (Rhythmic_grouping r); + void split (Array); + void split (int n); void print() const; void OK() const; - Array generate_beams(Array, int&); + Array generate_beams (Array, int&); /** multiply self to span #i#. In implementation, this isn't really const, but conceptually it is. */ - void extend(MInterval i) const; - void translate(Moment); + void extend (MInterval i) const; + void translate (Moment); private: void init(); void junk(); - void copy(Rhythmic_grouping const&); + void copy (Rhythmic_grouping const&); }; -Rhythmic_grouping parse_grouping(Array beat_i_arr, Array elt_length_arr); +Rhythmic_grouping parse_grouping (Array beat_i_arr, Array elt_length_arr); #endif diff --git a/lily/include/head-column.hh b/lily/include/head-column.hh index f95733201b..57c560b18b 100644 --- a/lily/include/head-column.hh +++ b/lily/include/head-column.hh @@ -29,9 +29,9 @@ public: int dir_i_; Stem* stem_l_; - void add(Note_head*); - virtual void add(Script*s); - virtual void set(Stem*); + void add (Note_head*); + virtual void add (Script*s); + virtual void set (Stem*); Head_column(); DECLARE_MY_RUNTIME_TYPEINFO; protected: @@ -39,6 +39,6 @@ protected: virtual void do_pre_processing(); virtual void do_print()const; - virtual void do_substitute_dependency(Score_elem*,Score_elem*); + virtual void do_substitute_dependency (Score_elem*,Score_elem*); }; #endif // HEAD_COLUMN_HH diff --git a/lily/include/head-grav.hh b/lily/include/head-grav.hh index 57711a27be..fdbbe7064c 100644 --- a/lily/include/head-grav.hh +++ b/lily/include/head-grav.hh @@ -20,7 +20,7 @@ public: Note_head_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual bool do_try_request(Request *req_l) ; + virtual bool do_try_request (Request *req_l) ; virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); diff --git a/lily/include/horizontal-align-item.hh b/lily/include/horizontal-align-item.hh index d66a85a99f..c1d6313657 100644 --- a/lily/include/horizontal-align-item.hh +++ b/lily/include/horizontal-align-item.hh @@ -17,7 +17,7 @@ - TODO: insert(order, elem) + TODO: insert (order, elem) */ class Horizontal_align_item : public Item { protected: @@ -34,16 +34,16 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_align_item); - void add(Item*, int p); + void add (Item*, int p); void OK()const; Horizontal_align_item(); protected: - virtual void do_substitute_dependency(Score_elem * , Score_elem *); + virtual void do_substitute_dependency (Score_elem * , Score_elem *); /// do calculations before determining horizontal spacing virtual void do_pre_processing(); virtual void do_print()const; virtual Interval do_width()const; - bool contains_b(Item*)const; + bool contains_b (Item*)const; }; #endif // HORIZONTAL_ALIGN_ITEM_HH diff --git a/lily/include/horizontal-group-item.hh b/lily/include/horizontal-group-item.hh index f1fc8b3c9c..b9045a4bdb 100644 --- a/lily/include/horizontal-group-item.hh +++ b/lily/include/horizontal-group-item.hh @@ -15,11 +15,11 @@ class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element { protected: - virtual void remove_all() { Horizontal_group_element::remove_all(); } + virtual void remove_all() { Horizontal_group_element::remove_all (); } virtual void do_print() const; public: - virtual void add_element(Score_elem*e) { Horizontal_group_element::add_element(e); } - virtual void remove_element(Score_elem*e) { Horizontal_group_element::remove_element(e); } + virtual void add_element (Score_elem*e) { Horizontal_group_element::add_element (e); } + virtual void remove_element (Score_elem*e) { Horizontal_group_element::remove_element (e); } DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_group_item); diff --git a/lily/include/ineq-constrained-qp.hh b/lily/include/ineq-constrained-qp.hh index d3cab9322c..7e28fd7a82 100644 --- a/lily/include/ineq-constrained-qp.hh +++ b/lily/include/ineq-constrained-qp.hh @@ -29,13 +29,13 @@ public: /** use a KKT method to assert optimality of sol */ - void assert_solution(Vector sol) const; + void assert_solution (Vector sol) const; /// solve the problem using a projected gradient method - Vector constraint_solve(Vector)const; + Vector constraint_solve (Vector)const; /** Solve it. First try it the easy way. */ - Vector solve(Vector start) const; + Vector solve (Vector start) const; /** @return the number of variables in the problem @@ -51,20 +51,20 @@ public: c*vars >= r PRE - c.dim() == dim(); + c.dim() == dim (); */ - void add_inequality_cons(Vector c, double r); + void add_inequality_cons (Vector c, double r); /** set up matrices to go with the problem. */ - Ineq_constrained_qp(int novars); + Ineq_constrained_qp (int novars); /** evaluate the quadratic function for input #v# */ - Real eval(Vector v); + Real eval (Vector v); - void eliminate_var(int idx, Real value); + void eliminate_var (int idx, Real value); void OK()const; void print() const; diff --git a/lily/include/input-translator.hh b/lily/include/input-translator.hh index 49f44bec01..14a35e507c 100644 --- a/lily/include/input-translator.hh +++ b/lily/include/input-translator.hh @@ -19,7 +19,7 @@ struct Input_translator_list : public Pointer_list { - Input_translator_list(Input_translator_list const &); + Input_translator_list (Input_translator_list const &); Input_translator_list(){} ~Input_translator_list(){} }; @@ -35,18 +35,18 @@ public: String type_str_; String default_id_str_; - void add(Input_translator *); - bool is_name_b(String); + void add (Input_translator *); + bool is_name_b (String); bool accept_req_b(); - bool accepts_b(String); + bool accepts_b (String); void print() const; Engraver_group_engraver * get_group_engraver_p(); Performer_group_performer * get_group_performer_p(); Input_translator * get_default_itrans_l(); - Input_translator * recursive_find(String nm); - Input_translator * find_itrans_l(String nm); + Input_translator * recursive_find (String nm); + Input_translator * find_itrans_l (String nm); }; -Engraver* get_engraver_p(String); -Performer* get_performer_p(String); +Engraver* get_engraver_p (String); +Performer* get_performer_p (String); #endif // Input_translator_HH diff --git a/lily/include/item.hh b/lily/include/item.hh index 0768c5885e..e465931074 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -35,8 +35,8 @@ public: int break_status_i_; /// nobreak = 0, pre = -1, post = 1 int break_status_i()const; - Item * find_prebroken_piece(PCol*)const; - Item * find_prebroken_piece(Line_of_score*)const; + Item * find_prebroken_piece (PCol*)const; + Item * find_prebroken_piece (Line_of_score*)const; virtual Item *item() { return this; } Item(); diff --git a/lily/include/key-grav.hh b/lily/include/key-grav.hh index 51a978e592..f60243fc8f 100644 --- a/lily/include/key-grav.hh +++ b/lily/include/key-grav.hh @@ -18,7 +18,7 @@ */ class Key_engraver : public Engraver { void create_key(); - void read_req(Key_change_req * r); + void read_req (Key_change_req * r); public: Key key_; @@ -29,11 +29,11 @@ public: bool change_key_b_; protected: - virtual bool do_try_request(Request *req_l); + virtual bool do_try_request (Request *req_l); virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); - virtual void acknowledge_element(Score_elem_info); + virtual void acknowledge_element (Score_elem_info); public: Key_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index b980e3ff0f..84d1ac709f 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -22,10 +22,10 @@ struct Key_item : Item { DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Key_item); - Key_item(int cposition); - void add(int pitch, int acc); - void read(const Key_engraver&); - void set_c_position(int); + Key_item (int cposition); + void add (int pitch, int acc); + void read (const Key_engraver&); + void set_c_position (int); protected: virtual void do_pre_processing(); Molecule* brew_molecule_p()const; diff --git a/lily/include/key-performer.hh b/lily/include/key-performer.hh index 6b1cba48f8..f459ea9353 100644 --- a/lily/include/key-performer.hh +++ b/lily/include/key-performer.hh @@ -20,7 +20,7 @@ public: protected: void do_print() const; - virtual bool do_try_request( Request* req_l ); + virtual bool do_try_request (Request* req_l); virtual void process_requests(); private: diff --git a/lily/include/key.hh b/lily/include/key.hh index d3d34a01ae..10c5779455 100644 --- a/lily/include/key.hh +++ b/lily/include/key.hh @@ -17,8 +17,8 @@ public: Array accidental_i_arr_; Octave_key(); - void set(int i, int acc); - int acc(int i)const { return accidental_i_arr_[i]; } + void set (int i, int acc); + int acc (int i)const { return accidental_i_arr_[i]; } }; /// administration of accidentals @@ -30,9 +30,9 @@ class Key public: bool multi_octave_b_; - Octave_key&oct(int); - void set(int name, int acc); - void set(int oct, int name, int acc); + Octave_key&oct (int); + void set (int name, int acc); + void set (int oct, int name, int acc); Key(); }; diff --git a/lily/include/keyword.hh b/lily/include/keyword.hh index a38935b398..4b40a979fc 100644 --- a/lily/include/keyword.hh +++ b/lily/include/keyword.hh @@ -18,8 +18,8 @@ struct Keyword_table { Keyword_ent *table; int maxkey; - Keyword_table(Keyword_ent *); - int lookup(char const *s) const; + Keyword_table (Keyword_ent *); + int lookup (char const *s) const; }; diff --git a/lily/include/leastsquares.hh b/lily/include/leastsquares.hh index 2e5c970fe5..c813f36bc4 100644 --- a/lily/include/leastsquares.hh +++ b/lily/include/leastsquares.hh @@ -15,7 +15,7 @@ */ struct Least_squares { Array input; - void minimise(Real &coef, Real &offset); + void minimise (Real &coef, Real &offset); void OK() const; }; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 468a656abb..5e42f95f1e 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -10,11 +10,25 @@ #define LILY_PROTO_HH #include "proto.hh" -struct My_lily_lexer; + struct Absolute_dynamic_req; +struct Axis_group_element; +struct Axis_group; struct Translator; +struct Audio_element; +struct Audio_column; +struct Audio_item; +struct Audio_key; +struct Audio_meter; +struct Audio_note; +struct Audio_note_off; +struct Audio_score; +struct Audio_staff; +struct Audio_tempo; struct Atom; struct Bar; +struct Bar_column_engraver; +struct Bar_column; struct Bar_engraver; struct Bar_req; struct Barcheck_req; @@ -31,6 +45,7 @@ struct Chord; struct Clef_change_req; struct Clef_item; struct Clef_engraver; +struct Clef_performer; struct Col_hpositions; struct Chord; struct Colinfo; @@ -42,7 +57,9 @@ struct Complex_music; struct Cresc_req; struct Crescendo ; struct Decresc_req; + struct Directional_spanner; +struct Disallow_break_req; struct Durational_req; struct Dynamic; struct Dynamic_req; @@ -53,26 +70,29 @@ struct General_script_def; struct Global_translator; struct Group_change_req; struct Group_feature_req; +struct Head_column; struct Horizontal_align_item; -struct Horizontal_group; +struct Horizontal_group_element; struct Horizontal_group_item; struct Horizontal_vertical_group; struct Idealspacing; struct Identifier; struct Interpreter; struct Input_file; -struct Input_engraver; struct Input_score; +struct Input_translator; struct Item; struct Key; struct Key_change_req; struct Key_item; struct Key_engraver; +struct Key_performer; struct Keyword; struct Keyword_table; struct Lily_stream; struct Line_of_score; struct Line_of_staff; +struct Line_spacer; struct Linestaff; struct Local_key; struct Local_key_item; @@ -80,20 +100,28 @@ struct Local_key_engraver; struct Lookup; struct Lyric_item; struct Lyric_req; +struct My_lily_lexer; struct Measure_grouping_req; struct Melodic_req; struct Meter; struct Meter_change_req; struct Meter_engraver; +struct Meter_performer; struct Midi_def; struct Midi_duration; struct Midi_header; struct Midi_item; +struct Midi_key; +struct Midi_meter; +struct Midi_note; +struct Midi_note_event; +struct Midi_note_off; struct Midi_output; -struct Midi_pitch; struct Midi_score; struct Midi_stream; +struct Midi_tempo; struct Midi_track; +struct Midi_walker; struct Mixed_qp; struct Molecule; struct Music_general_chord; @@ -105,14 +133,16 @@ struct Music_list; struct My_lily_parser; struct Note_column; struct Note_column_engraver; +struct Note_performer; struct Note_req; struct Note_head; struct Note_head_engraver; struct Notename_table; struct Offset; struct Output; +struct Performer; struct PCol; -struct PScore; +struct Paper_score; struct Paper_def; struct Partial_measure_req; struct Plet; @@ -120,6 +150,8 @@ struct Pulk_voice; struct Pulk_voices; struct Rational; struct Engraver_group_engraver; +struct Performer; +struct Performer_group_performer; struct Request; struct Request_column; struct Engraver; @@ -135,6 +167,7 @@ struct Score; struct Score_column; struct Score_elem; struct Score_elem_info; +struct Score_performer; struct Script; struct Script_column; struct Script_def; @@ -149,6 +182,8 @@ struct Spacing_req ; struct Span_dynamic_req; struct Span_req; struct Spanner; +struct Spring_spacer; +struct Staff_performer; struct Staff_side; struct Staff_symbol; struct Stem; @@ -161,6 +196,7 @@ struct Symtable; struct Symtables; struct Super_elem; struct Terminate_voice_req; +struct Tempo_req; struct Tex_stream; struct Text_def; struct Text_gob; @@ -174,13 +210,14 @@ struct Time_description; struct Timing_req; struct Vertical_brace; struct Vertical_spanner; -struct Vertical_group; +struct Vertical_group_element; struct Vertical_align_spanner; struct Vertical_align_engraver; struct Vertical_align_element; struct Voice; -struct Voice_element; +struct Request_chord; struct Voice_group_engravers; +struct Voice_group_performer; struct Voice_list; struct Voice_engravers; struct Voicegroup; diff --git a/lily/include/line-group-grav.hh b/lily/include/line-group-grav.hh index 2c3393806f..65e35726df 100644 --- a/lily/include/line-group-grav.hh +++ b/lily/include/line-group-grav.hh @@ -21,7 +21,7 @@ class Line_group_engraver : public Engraver{ protected: virtual void do_creation_processing(); virtual void do_removal_processing(); - virtual void acknowledge_element(Score_elem_info); + virtual void acknowledge_element (Score_elem_info); public: DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/line-spacer.hh b/lily/include/line-spacer.hh index 96ef38d42f..f6f6cfe5c7 100644 --- a/lily/include/line-spacer.hh +++ b/lily/include/line-spacer.hh @@ -31,17 +31,17 @@ public: /** solve the spacing problem */ - virtual void solve(Col_hpositions *) const=0; + virtual void solve (Col_hpositions *) const=0; /** Approximate the spacing problem: return a lower bound on the energy */ - virtual void lower_bound_solution(Col_hpositions *) const=0; + virtual void lower_bound_solution (Col_hpositions *) const=0; /** add a col to the problem. columns have to be added left to right. The column contains info on it's minimum width. */ - virtual void add_column(PCol *, bool fixed=false, Real fixpos=0.0)=0; + virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0)=0; /** can the posed problem be solved? @@ -51,7 +51,7 @@ public: prepare() was called */ - virtual bool check_constraints(Vector v) const=0; + virtual bool check_constraints (Vector v) const=0; /** generate a solution which can't fail diff --git a/lily/include/linespace.hh b/lily/include/linespace.hh index 60e52bed6c..415a5376be 100644 --- a/lily/include/linespace.hh +++ b/lily/include/linespace.hh @@ -46,9 +46,9 @@ class Spacing_problem { Array loose_col_arr_; /// mark column #i# as being loose. - void loosen_column(int i); + void loosen_column (int i); /// the index of #c# in #cols# - int col_id(PCol const *c) const; + int col_id (PCol const *c) const; /// generate an (nonoptimal) solution Vector find_initial_solution() const; @@ -57,17 +57,17 @@ class Spacing_problem { bool check_feasible() const; /// does #this# contain the column #w#? - bool contains(PCol const *w); + bool contains (PCol const *w); /// make the energy function - void make_matrices(Matrix &quad, Vector &lin,Real&) const; + void make_matrices (Matrix &quad, Vector &lin,Real&) const; /// generate the LP constraints - void make_constraints(Mixed_qp& lp) const; + void make_constraints (Mixed_qp& lp) const; void handle_loose_cols(); - void position_loose_cols(Vector &) const; + void position_loose_cols (Vector &) const; /** add a idealspacing to the problem. @@ -75,13 +75,13 @@ class Spacing_problem { since they can be "summed" if the columns to which #i# refers are not in this problem, the spacing is ignored. */ - void add_ideal(Idealspacing const *i); - void print_ideal(Idealspacing const *)const; + void add_ideal (Idealspacing const *i); + void print_ideal (Idealspacing const *)const; Vector try_initial_solution() const; void calcideal(); - Score_column* scol_l(int); - void connect(int i,int j, Real,Real); + Score_column* scol_l (int); + void connect (int i,int j, Real,Real); public: static Line_spacer *constructor() { return new Line_spacer; @@ -89,13 +89,13 @@ public: Array error_pcol_l_arr() const; virtual Array solve() const; - virtual void add_column(PCol *, bool fixed=false, Real fixpos=0.0); + virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0); virtual Vector default_solution() contains { return try_initial_solution() ; } - virtual bool check_constraints(Vector v) const; + virtual bool check_constraints (Vector v) const; virtual void OK() const; virtual void print() const; virtual void prepare(); diff --git a/lily/include/local-key-grav.hh b/lily/include/local-key-grav.hh index 0530099634..e060dc6188 100644 --- a/lily/include/local-key-grav.hh +++ b/lily/include/local-key-grav.hh @@ -21,7 +21,7 @@ struct Local_key_engraver : Engraver { Link_array tied_l_arr_; /* *************** */ virtual void do_process_requests(); - virtual void acknowledge_element(Score_elem_info); + virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing(); Local_key_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index 7316df60e7..467f331201 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -13,7 +13,7 @@ struct Local_acc { int name_i_; int accidental_i_; int octave_i_; - static int compare(Local_acc&, Local_acc&); + static int compare (Local_acc&, Local_acc&); }; /** @@ -36,13 +36,13 @@ public: - Local_key_item(int c0position); - void add_support(Item*); - void add(int oct, int pitch, int acc); - void add(Melodic_req*); + Local_key_item (int c0position); + void add_support (Item*); + void add (int oct, int pitch, int acc); + void add (Melodic_req*); protected: virtual void do_pre_processing(); - virtual void do_substitute_dependency(Score_elem*,Score_elem*); + virtual void do_substitute_dependency (Score_elem*,Score_elem*); virtual Molecule* brew_molecule_p()const; }; #endif // LOCALKEYITEM_HH diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index d5e0d07fd4..46155bded3 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -19,45 +19,45 @@ struct Lookup { Symtables *symtables_; String texsetting; /* *************** */ - void add(String, Symtable*); + void add (String, Symtable*); void print()const; - Symbol linestaff(int n, Real w)const; - Symbol fill(Box b)const; - Symbol beam_element(int,int,Real=0)const; + Symbol linestaff (int n, Real w)const; + Symbol fill (Box b)const; + Symbol beam_element (int,int,Real=0)const; /// round slope to closest TeXslope - Symbol beam(Real&,Real)const; + Symbol beam (Real&,Real)const; /** pos == 3 : 3 lines above staff (extending below note) pos == -3: below staff */ - Symbol streepjes(int pos)const; + Symbol streepjes (int pos)const; - Symbol vbrace(Real &dy) const; - Symbol meter(Array)const; - Symbol stem(Real y1_pos, Real y2_pos)const; - Symbol rule_symbol(Real height, Real width)const; - Symbol accidental(int)const; - Symbol ball(int)const; - Symbol flag(int)const; - Symbol rest(int, bool outside)const; - Symbol clef(String)const; - Symbol bar(String, Real height)const; + Symbol vbrace (Real &dy) const; + Symbol meter (Array)const; + Symbol stem (Real y1_pos, Real y2_pos)const; + Symbol rule_symbol (Real height, Real width)const; + Symbol accidental (int)const; + Symbol ball (int)const; + Symbol flag (int)const; + Symbol rest (int, bool outside)const; + Symbol clef (String)const; + Symbol bar (String, Real height)const; - Symbol dots(int)const; - Symbol slur(int dy, Real &dx, int dir)const; - Symbol half_slur(int dy, Real &dx, int dir, int xpart)const; - Symbol half_slur_middlepart(Real &dx, int dir)const; - Symbol big_slur(int dy, Real &dx, int dir)const; - Symbol text(String style, String text, int align = 1)const; - Symbol script(String idx)const; - Symbol hairpin(Real & width, bool decresc)const; - Symbol dynamic(String)const; + Symbol dots (int)const; + Symbol slur (int dy, Real &dx, int dir)const; + Symbol half_slur (int dy, Real &dx, int dir, int xpart)const; + Symbol half_slur_middlepart (Real &dx, int dir)const; + Symbol big_slur (int dy, Real &dx, int dir)const; + Symbol text (String style, String text, int align = 1)const; + Symbol script (String idx)const; + Symbol hairpin (Real & width, bool decresc)const; + Symbol dynamic (String)const; Lookup(); - Lookup(Lookup const &); + Lookup (Lookup const &); ~Lookup(); }; diff --git a/lily/include/lyric-engraver.hh b/lily/include/lyric-engraver.hh index 8e18c8ed6a..632e9c571e 100644 --- a/lily/include/lyric-engraver.hh +++ b/lily/include/lyric-engraver.hh @@ -19,7 +19,7 @@ class Lyric_engraver : public Engraver { Text_item *lyric_item_p_; protected: virtual void do_pre_move_processing(); - virtual bool do_try_request(Request*); + virtual bool do_try_request (Request*); virtual void do_process_requests(); virtual void do_post_move_processing(); public: diff --git a/lily/include/lyric-performer.hh b/lily/include/lyric-performer.hh index c0321c2839..f03c4faaf0 100644 --- a/lily/include/lyric-performer.hh +++ b/lily/include/lyric-performer.hh @@ -22,7 +22,7 @@ public: protected: void do_print() const; - virtual bool do_try_request( Request* req_l ); + virtual bool do_try_request (Request* req_l); virtual void process_requests(); private: diff --git a/lily/include/main.hh b/lily/include/main.hh index 0c461a36d6..79ac1e878e 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -3,12 +3,12 @@ #include "lily-proto.hh" void debug_init(); -void set_debug(bool); +void set_debug (bool); void do_scores(); -void add_score(Score* s); -void set_default_output(String s); +void add_score (Score* s); +void set_default_output (String s); Input_score* current_iscore_l(); -String find_file(String); +String find_file (String); String get_version_str(); extern Sources* source_l_g; extern bool only_midi; diff --git a/lily/include/meter-grav.hh b/lily/include/meter-grav.hh index d1085f63fe..9c1d72d820 100644 --- a/lily/include/meter-grav.hh +++ b/lily/include/meter-grav.hh @@ -24,8 +24,8 @@ public: Meter_change_req * meter_req_l_; Meter * meter_p_; - virtual void fill_staff_info(Staff_info&); - virtual bool do_try_request(Request *req_l); + virtual void fill_staff_info (Staff_info&); + virtual bool do_try_request (Request *req_l); virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_creation_processing(); diff --git a/lily/include/meter-performer.hh b/lily/include/meter-performer.hh index 3d972c10e8..51edbad020 100644 --- a/lily/include/meter-performer.hh +++ b/lily/include/meter-performer.hh @@ -20,7 +20,7 @@ public: protected: void do_print() const; - virtual bool do_try_request( Request* req_l ); + virtual bool do_try_request (Request* req_l); virtual void process_requests(); private: diff --git a/lily/include/meter.hh b/lily/include/meter.hh index eb5f2b128e..8347b3fa2d 100644 --- a/lily/include/meter.hh +++ b/lily/include/meter.hh @@ -22,7 +22,7 @@ class Meter: public Item { protected: Molecule*brew_molecule_p() const; public: - Meter(Array args) ; + Meter (Array args) ; DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Meter); }; diff --git a/lily/include/midi-def.hh b/lily/include/midi-def.hh index 89a7543567..bb96d961e8 100644 --- a/lily/include/midi-def.hh +++ b/lily/include/midi-def.hh @@ -32,15 +32,15 @@ struct Midi_def { Real whole_seconds_f_; Midi_def(); - Midi_def( Midi_def const& midi_c_r ); + Midi_def (Midi_def const& midi_c_r); ~Midi_def(); - Real duration_to_seconds_f(Moment); + Real duration_to_seconds_f (Moment); Global_translator* get_global_translator_p() const; - int get_tempo_i( Moment moment ); + int get_tempo_i (Moment moment); void print() const; - void set( Input_translator* itrans_p ); - void set_tempo( Moment moment, int count_per_minute_i ); + void set (Input_translator* itrans_p); + void set_tempo (Moment moment, int count_per_minute_i); }; #endif // MIDI_DEF_HH diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index 4906f27ba8..c422e04db8 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -19,17 +19,17 @@ */ struct Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_item( Audio_item* audio_item_l ); - static String i2varint_str( int i ); - void output( Midi_stream* midi_stream_l ) const; + Midi_item (Audio_item* audio_item_l); + static String i2varint_str (int i); + void output (Midi_stream* midi_stream_l) const; virtual String str() const = 0; Audio_item* audio_item_l_; int channel_i_; private: - Midi_item( Midi_item const& ); - Midi_item& operator =( Midi_item const& ); + Midi_item (Midi_item const&); + Midi_item& operator =( Midi_item const&); }; /** @@ -39,8 +39,8 @@ struct Midi_chunk : Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; Midi_chunk(); - void add( String str ); - void set( String header_str, String data_str, String footer_str ); + void add (String str); + void set (String header_str, String data_str, String footer_str); virtual String str() const; private: @@ -51,7 +51,7 @@ private: struct Midi_duration : public Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_duration( Real seconds_f ); + Midi_duration (Real seconds_f); virtual String str() const; Real seconds_f_; @@ -60,7 +60,7 @@ struct Midi_duration : public Midi_item { struct Midi_header : Midi_chunk { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_header( int format_i, int tracks_i, int clocks_per_4_i ); + Midi_header (int format_i, int tracks_i, int clocks_per_4_i); }; @@ -69,7 +69,7 @@ struct Midi_header : Midi_chunk { */ struct Midi_instrument : public Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_instrument( int channel_i, String instrument_str ); + Midi_instrument (int channel_i, String instrument_str); virtual String str() const; String instrument_str_; @@ -78,7 +78,7 @@ struct Midi_instrument : public Midi_item { struct Midi_key : public Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_key( Audio_item* audio_item_l ); + Midi_key (Audio_item* audio_item_l); virtual String str() const; }; @@ -86,7 +86,7 @@ struct Midi_key : public Midi_item { struct Midi_meter : Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_meter( Audio_item* audio_item_l ); + Midi_meter (Audio_item* audio_item_l); virtual String str() const; int clocks_per_1_i_; @@ -97,7 +97,7 @@ struct Midi_meter : Midi_item { */ struct Midi_note : public Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_note( Audio_item* audio_item_l ); + Midi_note (Audio_item* audio_item_l); Moment duration() const; int pitch_i() const; @@ -112,7 +112,7 @@ struct Midi_note : public Midi_item { */ struct Midi_note_off : public Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_note_off( Midi_note* midi_note_l ); + Midi_note_off (Midi_note* midi_note_l); int pitch_i() const; virtual String str() const; @@ -127,8 +127,8 @@ struct Midi_text : Midi_item { TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, MARKER, CUE_POINT }; - Midi_text( Midi_text::Type type, String text_str ); - Midi_text( Audio_item* audio_item_l ); + Midi_text (Midi_text::Type type, String text_str); + Midi_text (Audio_item* audio_item_l); virtual String str() const; @@ -138,8 +138,8 @@ struct Midi_text : Midi_item { struct Midi_tempo : Midi_item { DECLARE_MY_RUNTIME_TYPEINFO; - Midi_tempo( int per_minute_4_i ); - Midi_tempo( Audio_item* audio_item_l ); + Midi_tempo (int per_minute_4_i); + Midi_tempo (Audio_item* audio_item_l); virtual String str() const; @@ -152,8 +152,8 @@ struct Midi_track : Midi_chunk { Midi_track(); - void add( int delta_time_i, String event ); - void add( Moment delta_time_moment, Midi_item* mitem_l ); + void add (int delta_time_i, String event); + void add (Moment delta_time_moment, Midi_item* mitem_l); }; #endif // MIDI_ITEM_HH diff --git a/lily/include/midi-stream.hh b/lily/include/midi-stream.hh index 9fded298d5..87e8ec5d27 100644 --- a/lily/include/midi-stream.hh +++ b/lily/include/midi-stream.hh @@ -12,12 +12,12 @@ /// Midi outputfile struct Midi_stream { - Midi_stream( String filename_str ); + Midi_stream (String filename_str); ~Midi_stream(); - Midi_stream& operator <<( String str ); - Midi_stream& operator <<( Midi_item const& mitem_c_r ); - Midi_stream& operator <<( int i ); + Midi_stream& operator <<( String str); + Midi_stream& operator <<( Midi_item const& mitem_c_r); + Midi_stream& operator <<( int i); void open(); diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index a9ce619a09..313e21af3d 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -21,7 +21,7 @@ struct Midi_note_event : PQueue_ent Midi_note_event(); }; -int compare(Midi_note_event const& left, Midi_note_event const& right ); +int compare (Midi_note_event const& left, Midi_note_event const& right); /** walk audio and output midi @@ -29,15 +29,15 @@ int compare(Midi_note_event const& left, Midi_note_event const& right ); class Midi_walker : public PCursor { public: - Midi_walker( Audio_staff* audio_staff_l, Midi_track* midi_track_l ); + Midi_walker (Audio_staff* audio_staff_l, Midi_track* midi_track_l); ~Midi_walker(); void process(); private: - void do_start_note( Midi_note* note_l ); - void do_stop_notes( Moment now_mom ); - void output_event( Moment now_mom, Midi_item* l ); + void do_start_note (Midi_note* note_l); + void do_stop_notes (Moment now_mom); + void output_event (Moment now_mom, Midi_item* l); Midi_track* track_l_; PQueue stop_note_queue; diff --git a/lily/include/misc.hh b/lily/include/misc.hh index 8ba5e10b78..0e8c148ef0 100644 --- a/lily/include/misc.hh +++ b/lily/include/misc.hh @@ -7,20 +7,20 @@ #include "scalar.hh" #include "grouping.hh" -Moment wholes(int dur, int dots); +Moment wholes (int dur, int dots); double log_2(double x) ; int intlog2(int d); inline int -abs(int i){ +abs (int i){ return (i < 0)?-i:i; } inline int -sign(int i) { +sign (int i) { if (i<0) return -1; else if (i) return 1; else return 0; } -Interval itemlist_width(const Array &its); +Interval itemlist_width (const Array &its); #endif diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index d1057bebf0..b031688e21 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -14,22 +14,22 @@ struct Molecule { /* *************** */ Molecule() { } - Molecule(Atom const &a) { add(a) ;} + Molecule (Atom const &a) { add (a) ;} - void add_right(const Molecule &m); - void add_left(const Molecule &m); - void add_top(const Molecule &m); - void add_bottom(const Molecule &m); - void add(Molecule const &m); - void translate(Offset); - void translate(Real,Axis); - void add(Atom const & a) ; + void add_right (const Molecule &m); + void add_left (const Molecule &m); + void add_top (const Molecule &m); + void add_bottom (const Molecule &m); + void add (Molecule const &m); + void translate (Offset); + void translate (Real,Axis); + void add (Atom const & a) ; /// how big is #this#? Box extent() const; String TeX_string() const; - Molecule(const Molecule&s); + Molecule (const Molecule&s); void print() const; private: void operator=(const Molecule&); diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index c38340706e..636fc659c9 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -17,25 +17,25 @@ class Music_iterator { Arrayreport_to_l_arr_; - void push_translator(Translator*); + void push_translator (Translator*); void pop_translator(); protected: bool first_b_; virtual void do_print()const; virtual Translator * get_req_translator_l(); - Music_iterator* get_iterator_p(Music*)const; - void set_translator(Translator*); + Music_iterator* get_iterator_p (Music*)const; + void set_translator (Translator*); Music_iterator *daddy_iter_l_; public: Translator *report_to_l()const; DECLARE_MY_RUNTIME_TYPEINFO; - static Music_iterator* static_get_iterator_p(Music*,Translator*); + static Music_iterator* static_get_iterator_p (Music*,Translator*); Music_iterator(); - virtual void process_and_next(Moment until); + virtual void process_and_next (Moment until); virtual Moment next_moment()const; virtual bool ok()const; virtual ~Music_iterator(); @@ -50,12 +50,12 @@ class Chord_iterator : public Music_iterator Pointer_list children_p_list_; public: ~Chord_iterator(); - Chord_iterator(Chord const*); + Chord_iterator (Chord const*); DECLARE_MY_RUNTIME_TYPEINFO; protected: virtual void do_print()const; virtual void construct_children(); - virtual void process_and_next(Moment); + virtual void process_and_next (Moment); virtual Moment next_moment()const; virtual bool ok()const; }; @@ -65,11 +65,11 @@ class Request_chord_iterator : public Music_iterator { Moment elt_duration_; bool last_b_; public: - Request_chord_iterator(Request_chord*); + Request_chord_iterator (Request_chord*); DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual void process_and_next(Moment); + virtual void process_and_next (Moment); virtual Moment next_moment()const; virtual void construct_children(); virtual bool ok()const; @@ -87,13 +87,13 @@ class Voice_iterator : private PCursor, public Music_iterator void set_voice_translator(); public: - Voice_iterator(Voice const*); + Voice_iterator (Voice const*); DECLARE_MY_RUNTIME_TYPEINFO; protected: virtual void do_print()const; virtual void construct_children(); ~Voice_iterator(); - virtual void process_and_next(Moment); + virtual void process_and_next (Moment); virtual Moment next_moment()const; virtual bool ok()const; }; diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index bcae7cff83..2ce9625999 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -22,12 +22,12 @@ class Music_list : public Music { public: int multi_level_i_; - Music_list(Music_list const&); + Music_list (Music_list const&); Music_list(); DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Music_list,Music); - virtual void add(Music*); - virtual void transpose(Melodic_req const *); + virtual void add (Music*); + virtual void transpose (Melodic_req const *); Pointer_list music_p_list_; protected: @@ -44,7 +44,7 @@ public: Chord(); DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Chord,Music); - virtual void translate(Moment dt); + virtual void translate (Moment dt); virtual MInterval time_int()const; }; @@ -70,7 +70,7 @@ public: Voice(); DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Voice, Music); - virtual void translate(Moment dt); + virtual void translate (Moment dt); virtual MInterval time_int()const; }; diff --git a/lily/include/music.hh b/lily/include/music.hh index 63ce4b8799..5aec401462 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -45,8 +45,8 @@ public: virtual MInterval time_int()const; virtual ~Music(){} void print() const; - virtual void transpose(Melodic_req const *); - virtual void translate(Moment dt); + virtual void transpose (Melodic_req const *); + virtual void translate (Moment dt); VIRTUAL_COPY_CONS(Music,Music); DECLARE_MY_RUNTIME_TYPEINFO; Music(); diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 6152be7782..2346d1625c 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -50,11 +50,11 @@ public: Duration duration_; /* *************** */ - void set_duration(Duration); - bool do_equal_b(Request*)const; + void set_duration (Duration); + bool do_equal_b (Request*)const; virtual Moment duration() const; Rhythmic_req(); - static int compare(Rhythmic_req const&,Rhythmic_req const&); + static int compare (Rhythmic_req const&,Rhythmic_req const&); REQUESTMETHODS(Rhythmic_req, rhythmic); }; @@ -86,9 +86,9 @@ public: Text_def *tdef_p_; /* *************** */ - Text_req(int d, Text_def*); + Text_req (int d, Text_def*); ~Text_req(); - Text_req(Text_req const&); + Text_req (Text_req const&); REQUESTMETHODS(Text_req,text); }; @@ -98,7 +98,7 @@ public: */ class Lyric_req : public Rhythmic_req, public Text_req { public: - Lyric_req(Text_def* t_p); + Lyric_req (Text_def* t_p); REQUESTMETHODS(Lyric_req, lreq_l); }; @@ -117,12 +117,12 @@ struct Melodic_req :virtual Musical_req int height()const; /// transpose. #delta# is relative to central c. - void transpose(Melodic_req const &delta); + void transpose (Melodic_req const &delta); /// return pitch from central c (in halfnotes) int pitch()const; Melodic_req(); - bool do_equal_b(Request*)const; - static int compare( Melodic_req const&,Melodic_req const&); + bool do_equal_b (Request*)const; + static int compare (Melodic_req const&,Melodic_req const&); REQUESTMETHODS(Melodic_req,melodic); }; @@ -133,8 +133,8 @@ public: /// force/supress printing of accidental. bool forceacc_b_; Note_req(); - bool do_equal_b(Request*)const; - Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); } + bool do_equal_b (Request*)const; + Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); } REQUESTMETHODS(Note_req, note); }; @@ -168,7 +168,7 @@ public: enum { NOSPAN, START, STOP } spantype ; - bool do_equal_b(Request*)const; + bool do_equal_b (Request*)const; REQUESTMETHODS(Span_req,span); Span_req(); @@ -214,7 +214,7 @@ public: enum Loudness { FFF, FF, F, MF, MP, P, PP, PPP }; - static String loudness_str(Loudness); + static String loudness_str (Loudness); REQUESTMETHODS(Dynamic_req, dynamic); }; diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index e606a0f4b3..8869ccb514 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -25,16 +25,16 @@ class My_lily_parser { Array define_spot_array_; String init_str_; - void add_requests( Chord*v); + void add_requests (Chord*v); - Chord * get_note_element(Note_req * ,Duration *); - Chord* get_rest_element(String,Duration *); - Chord* get_word_element(Text_def*, Duration*); + Chord * get_note_element (Note_req * ,Duration *); + Chord* get_rest_element (String,Duration *); + Chord* get_word_element (Text_def*, Duration*); - void set_last_duration(Duration const *); - void set_default_duration(Duration const *); - void set_duration_mode(String s); - friend int yyparse( void*); + void set_last_duration (Duration const *); + void set_default_duration (Duration const *); + void set_duration_mode (String s); + friend int yyparse (void*); public: int default_octave_i_; Duration default_duration_; @@ -51,7 +51,7 @@ public: My_lily_lexer * lexer_p_; Moment plet_mom(); - void add_notename(String, Melodic_req* req_p); + void add_notename (String, Melodic_req* req_p); Input here_input()const; void remember_spot(); Input pop_spot(); @@ -59,21 +59,21 @@ public: Paper_def*default_paper(); Midi_def*default_midi(); void do_yyparse(); - void parser_error(String); + void parser_error (String); void clear_notenames(); - Request* get_parens_request(char c); + Request* get_parens_request (char c); void set_debug(); - void set_yydebug(bool); + void set_yydebug (bool); void print_declarations(); bool ignore_version_b_; public: void do_init_file(); void parse_file ( String init_str, String file_str); - My_lily_parser(Sources * sources_l); + My_lily_parser (Sources * sources_l); ~My_lily_parser(); - void set_version_check(bool ignore); + void set_version_check (bool ignore); }; #endif // MY_LILY_PARSER_HH diff --git a/lily/include/note-column-grav.hh b/lily/include/note-column-grav.hh index 43ebda4432..43784776f9 100644 --- a/lily/include/note-column-grav.hh +++ b/lily/include/note-column-grav.hh @@ -24,10 +24,10 @@ class Note_column_engraver :public Engraver { int dir_i_; - bool acceptable_elem_b(Score_elem const*)const; + bool acceptable_elem_b (Score_elem const*)const; protected: - virtual void set_feature(Feature); - virtual void acknowledge_element(Score_elem_info); + virtual void set_feature (Feature); + virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); public: diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 2e297e88a4..3ee218ec12 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -14,7 +14,7 @@ #include "head-column.hh" /** a struct for treating a group of noteheads (noteheads, stem - (chord) and scripts ) as a single entity. */ + (chord) and scripts) as a single entity. */ class Note_column : public Head_column { protected: virtual void do_pre_processing(); @@ -26,7 +26,7 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; Note_column(); - virtual void set(Stem *); + virtual void set (Stem *); void sort(); }; diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 14cd2491a8..6fab4812b5 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -37,14 +37,14 @@ public: /* *************** */ - void set_rhythmic(Rhythmic_req *); + void set_rhythmic (Rhythmic_req *); /** position of top line (5 linestaff: 8) */ - Note_head(int staff_size); + Note_head (int staff_size); void set_dots(); - static int compare(Note_head * const &a, Note_head *const &b) ; + static int compare (Note_head * const &a, Note_head *const &b) ; protected: virtual void do_print()const; virtual void do_pre_processing(); diff --git a/lily/include/note-performer.hh b/lily/include/note-performer.hh index 0fb8aecbd4..436b78bb2a 100644 --- a/lily/include/note-performer.hh +++ b/lily/include/note-performer.hh @@ -22,7 +22,7 @@ public: protected: virtual void process_requests(); - virtual bool do_try_request( Request *req_l ) ; + virtual bool do_try_request (Request *req_l) ; virtual void do_print() const; private: diff --git a/lily/include/notename-table.hh b/lily/include/notename-table.hh index 082dda366b..5e083a6d7c 100644 --- a/lily/include/notename-table.hh +++ b/lily/include/notename-table.hh @@ -17,8 +17,8 @@ class Notename_table : Assoc >{ public: - void add(String, Melodic_req*); - Melodic_req*get_l(String); + void add (String, Melodic_req*); + Melodic_req*get_l (String); }; #endif // NOTENAME_TABLE_HH diff --git a/lily/include/notename.hh b/lily/include/notename.hh index e0125e1a0b..426f7e4564 100644 --- a/lily/include/notename.hh +++ b/lily/include/notename.hh @@ -12,12 +12,12 @@ struct Notename_tab { String notetab[7*5]; - void set(int l, int s, String nm); - void lookup(int &large, int &small, String s); + void set (int l, int s, String nm); + void lookup (int &large, int &small, String s); }; -void set_notename_tab(Notename_tab*n); -void lookup_notename(int &large, int &small, String s); +void set_notename_tab (Notename_tab*n); +void lookup_notename (int &large, int &small, String s); #endif // NOTENAME_HH diff --git a/lily/include/offset.hh b/lily/include/offset.hh index 00bc73e0e2..b4ed5478ac 100644 --- a/lily/include/offset.hh +++ b/lily/include/offset.hh @@ -28,11 +28,11 @@ struct Offset { } Offset operator+=(Offset o) { - x()+=o.x(); - y()+=o.y(); + x()+=o.x (); + y()+=o.y (); return *this; } - Offset(Real ix , Real iy) { + Offset (Real ix , Real iy) { x()=ix; y()=iy; } diff --git a/lily/include/p-col.hh b/lily/include/p-col.hh index d66921dc87..797fde9584 100644 --- a/lily/include/p-col.hh +++ b/lily/include/p-col.hh @@ -60,7 +60,7 @@ public: bool breakpoint_b() const; void clean_breakable_items(); - void add(Item *i); + void add (Item *i); /// Can this be broken? true eg. for bars. bool breakable_b()const; @@ -75,8 +75,8 @@ public: @return < 0 if c1 < c2. */ - static int compare(const PCol &c1, const PCol &c2); - void set_rank(int); + static int compare (const PCol &c1, const PCol &c2); + void set_rank (int); void OK() const; void set_breakable(); @@ -89,12 +89,12 @@ private: -1 is uninitialised. */ int rank_i_; - PCol(PCol const&){} + PCol (PCol const&){} }; #include "compare.hh" -instantiate_compare(PCol &, PCol::compare); +INSTANTIATE_COMPARE(PCol &, PCol::compare); #endif diff --git a/lily/include/p-score.hh b/lily/include/p-score.hh index 12ba8c77ad..7c497cd919 100644 --- a/lily/include/p-score.hh +++ b/lily/include/p-score.hh @@ -41,33 +41,33 @@ public: /* *************** */ /* CONSTRUCTION */ - Paper_score(Paper_def*); + Paper_score (Paper_def*); /// add a line to the broken stuff. Positions given in #config# - void set_breaking(Array const &); + void set_breaking (Array const &); /** add an item. add the item in specified containers. If breakstatus is set properly, add it to the {pre,post}break of the pcol. */ - void typeset_item(Item *item_p, PCol *pcol_l); + void typeset_item (Item *item_p, PCol *pcol_l); /// add to bottom of pcols - void add(PCol*); + void add (PCol*); /** @return argument as a cursor of the list */ - PCursor find_col(PCol const *)const; + PCursor find_col (PCol const *)const; - Link_array col_range(PCol *left_l, PCol *right_l) const; - Link_array breakable_col_range(PCol*,PCol*) const; - Link_array broken_col_range(PCol*,PCol*) const; + Link_array col_range (PCol *left_l, PCol *right_l) const; + Link_array breakable_col_range (PCol*,PCol*) const; + Link_array broken_col_range (PCol*,PCol*) const; /* MAIN ROUTINES */ void process(); /// last deed of this struct - void output(Tex_stream &ts); + void output (Tex_stream &ts); /* UTILITY ROUTINES */ @@ -76,10 +76,10 @@ public: void OK()const; void print() const; ~Paper_score(); - void typeset_element(Score_elem*); - void typeset_broken_spanner(Spanner*); + void typeset_element (Score_elem*); + void typeset_broken_spanner (Spanner*); /// add a Spanner - void typeset_unbroken_spanner(Spanner*); + void typeset_unbroken_spanner (Spanner*); private: diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 44fc05e12a..cb75f8437f 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -43,15 +43,15 @@ public: /* *************** */ - void set_var(String, Real); + void set_var (String, Real); Real get_var (String)const; void reinit(); Paper_def(); - void set(Lookup*); - void set (Input_translator * ); + void set (Lookup*); + void set (Input_translator *); Global_translator * get_global_translator_p()const; ~Paper_def(); - Paper_def(Paper_def const&); + Paper_def (Paper_def const&); /// The distance between beams Real interbeam_f()const; /** @@ -77,7 +77,7 @@ public: /** convert a duration to an idealspacing influence using the geometric_ and parameters. */ - Real duration_to_dist(Moment); + Real duration_to_dist (Moment); }; #endif // Paper_def_HH diff --git a/lily/include/parseconstruct.hh b/lily/include/parseconstruct.hh index 2059719880..1bcf0cc4f7 100644 --- a/lily/include/parseconstruct.hh +++ b/lily/include/parseconstruct.hh @@ -9,13 +9,13 @@ #include "lily-proto.hh" -String * get_scriptdef(char c); -Request* get_script_req(char); -Request*get_script_req(int d , Script_def*def); -Request*get_text_req(int d , Text_def*def); -Request* get_stemdir_req(int); -Request*get_grouping_req(Array i_arr); -Request* get_hshift_req(int); +String * get_scriptdef (char c); +Request* get_script_req (char); +Request*get_script_req (int d , Script_def*def); +Request*get_text_req (int d , Text_def*def); +Request* get_stemdir_req (int); +Request*get_grouping_req (Array i_arr); +Request* get_hshift_req (int); #endif // PARSECONSTRUCT_HH diff --git a/lily/include/performer-group-performer.hh b/lily/include/performer-group-performer.hh index 4c57fc7af8..5c640cc636 100644 --- a/lily/include/performer-group-performer.hh +++ b/lily/include/performer-group-performer.hh @@ -23,18 +23,18 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; Input_translator* itrans_l_; - virtual void add( Performer* perf_p ); - virtual bool do_try_request( Request* req_l ); + virtual void add (Performer* perf_p); + virtual bool do_try_request (Request* req_l); virtual void print() const; - virtual bool try_request(Request* r); + virtual bool try_request (Request* r); protected: virtual ~Performer_group_performer(); - virtual Translator* find_get_translator_l( String name, String id ); + virtual Translator* find_get_translator_l (String name, String id); virtual Translator* get_default_interpreter(); - Translator * ancestor_l( int l = 1 ); + Translator * ancestor_l (int l = 1); virtual int depth_i() const; virtual void process_requests(); @@ -42,7 +42,7 @@ protected: virtual void do_creation_processing(); bool is_bottom_performer_b() const; - virtual Performer_group_performer* find_performer_l( String name, String id ); + virtual Performer_group_performer* find_performer_l (String name, String id); virtual void do_print()const; private: diff --git a/lily/include/performer.hh b/lily/include/performer.hh index 0126c7b231..8e9553f08f 100644 --- a/lily/include/performer.hh +++ b/lily/include/performer.hh @@ -30,17 +30,17 @@ public: void print() const; virtual void process_requests(); - virtual bool try_request( Request* req_l ); + virtual bool try_request (Request* req_l); virtual void do_removal_processing(); void creation_processing(); protected: virtual void do_creation_processing(); - virtual bool do_try_request(Request*); + virtual bool do_try_request (Request*); virtual int get_tempo_i() const; virtual void do_print() const; - virtual void play( Audio_element * elem_p ); + virtual void play (Audio_element * elem_p ); }; #include "global-performers.hh" diff --git a/lily/include/qlp.hh b/lily/include/qlp.hh index defcd3ee63..e40b34ff07 100644 --- a/lily/include/qlp.hh +++ b/lily/include/qlp.hh @@ -23,12 +23,12 @@ class Mixed_qp :public Ineq_constrained_qp { Array eq_cons; Array eq_consrhs; public: - Mixed_qp(int n); + Mixed_qp (int n); void OK() const; void print() const; - Vector solve(Vector start) const; - void add_fixed_var(int i , Real value); + Vector solve (Vector start) const; + void add_fixed_var (int i , Real value); /** @@ -37,8 +37,8 @@ public: c*vars == r PRE - c.dim()==dim(); + c.dim()==dim (); */ - void add_equality_cons(Vector c, double r); + void add_equality_cons (Vector c, double r); }; #endif diff --git a/lily/include/qlpsolve.hh b/lily/include/qlpsolve.hh index 56b84e2e16..3ef601188a 100644 --- a/lily/include/qlpsolve.hh +++ b/lily/include/qlpsolve.hh @@ -37,8 +37,8 @@ class Active_constraints { public: String status()const; - Vector vec(int k) const { return opt->cons[k]; } - Real rhs(int k) const { return opt->consrhs[k]; } + Vector vec (int k) const { return opt->cons[k]; } + Real rhs (int k) const { return opt->consrhs[k]; } /** drop constraint. drop constraint k from the active set. k is the index of the @@ -52,18 +52,18 @@ public: add constraint j to the active set j is the index of the constraint in #inactive# */ - void add(int j); + void add (int j); /// exchange in and out. - void exchange(int in, int out) { add(in); drop (out); } + void exchange (int in, int out) { add (in); drop (out); } - Vector find_active_optimum(Vector g); + Vector find_active_optimum (Vector g); /// get lagrange multipliers. - Vector get_lagrange(Vector v); + Vector get_lagrange (Vector v); - Active_constraints(Ineq_constrained_qp const *op); + Active_constraints (Ineq_constrained_qp const *op); /** construct: no constraints active, n vars. Put the equalities into the constraints. */ @@ -79,13 +79,13 @@ class Inactive_iter { int j; Active_constraints const* ac; public: - Inactive_iter(Active_constraints const &c) { ac=&c; j=0; } + Inactive_iter (Active_constraints const &c) { ac=&c; j=0; } int idx() const { return j; } void operator ++(int) { j++; } int constraint_id() const { return ac->inactive[j]; } - Vector vec() const { return ac->vec(constraint_id()); } - Real rhs() const { return ac->rhs(constraint_id()); } - bool ok() const { return j < ac->inactive.size(); } + Vector vec() const { return ac->vec (constraint_id ()); } + Real rhs() const { return ac->rhs (constraint_id ()); } + bool ok() const { return j < ac->inactive.size (); } }; #endif // QLPSOLVE_HH diff --git a/lily/include/request.hh b/lily/include/request.hh index 07e480137e..3dc1eb9ba2 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -33,7 +33,7 @@ public: VIRTUAL_COPY_CONS(Request,Music); virtual MInterval time_int() const; - virtual void transpose(Melodic_req const &){} + virtual void transpose (Melodic_req const &){} virtual Moment duration() const { return 0; } /* accessors for children @@ -46,9 +46,9 @@ public: virtual Blank_req * blank() { return 0; } virtual Musical_req *musical() { return 0; } virtual Command_req * command() { return 0; } - bool equal_b(Request*) const; + bool equal_b (Request*) const; protected: - virtual bool do_equal_b(Request*) const; + virtual bool do_equal_b (Request*) const; virtual void do_print()const; }; @@ -69,12 +69,12 @@ public: General_script_def *scriptdef_p_; /* *************** */ - bool do_equal_b(Request*)const; + bool do_equal_b (Request*)const; Script_req(); REQUESTMETHODS(Script_req,script); ~Script_req(); - Script_req(Script_req const&); + Script_req (Script_req const&); }; diff --git a/lily/include/rest-column.hh b/lily/include/rest-column.hh index 6dfdaf16c9..61fafc5bda 100644 --- a/lily/include/rest-column.hh +++ b/lily/include/rest-column.hh @@ -18,7 +18,7 @@ class Rest_column : public Head_column { public: DECLARE_MY_RUNTIME_TYPEINFO; - void translate_heads(int dy); + void translate_heads (int dy); }; #endif // REST_COLUMN_HH diff --git a/lily/include/score-align-grav.hh b/lily/include/score-align-grav.hh index 718137ecfa..dc6eae2b65 100644 --- a/lily/include/score-align-grav.hh +++ b/lily/include/score-align-grav.hh @@ -25,7 +25,7 @@ public: Score_align_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual void acknowledge_element(Score_elem_info); + virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing(); }; #endif // SCORE_ALIGN_GRAV_HH diff --git a/lily/include/score-column.hh b/lily/include/score-column.hh index e108bc8213..0e19baa461 100644 --- a/lily/include/score-column.hh +++ b/lily/include/score-column.hh @@ -38,8 +38,8 @@ public: /* *************** */ Moment when() { return when_; } - Score_column(Moment when); - void add_duration(Moment ); + Score_column (Moment when); + void add_duration (Moment); void preprocess(); bool musical_b() { return musical_b_; } void print() const; diff --git a/lily/include/score-elem-info.hh b/lily/include/score-elem-info.hh index 4e6b609ff2..17b8172ee6 100644 --- a/lily/include/score-elem-info.hh +++ b/lily/include/score-elem-info.hh @@ -23,7 +23,7 @@ struct Score_elem_info { Array origin_grav_l_arr_; /* *** */ - Score_elem_info(Score_elem*, Request*); + Score_elem_info (Score_elem*, Request*); Score_elem_info(); }; diff --git a/lily/include/score-elem.hh b/lily/include/score-elem.hh index 82a6fbfe3d..7e7259f6a2 100644 --- a/lily/include/score-elem.hh +++ b/lily/include/score-elem.hh @@ -53,8 +53,8 @@ class Score_elem : private Directed_graph_node { Status status_; - Score_elem* dependency(int) const; - Score_elem* dependent(int) const; + Score_elem* dependency (int) const; + Score_elem* dependent (int) const; int dependent_size() const; int dependency_size() const; public: @@ -70,9 +70,9 @@ public: Paper_score *pscore_l_; Axis_group_element * axis_group_l_a_[2]; - Score_elem(Score_elem const&); - virtual String TeX_string () const ; - String TeX_string_without_offset(Offset)const; + Score_elem (Score_elem const&); + virtual String TeX_string() const ; + String TeX_string_without_offset (Offset)const; virtual void print() const; Paper_def *paper() const; @@ -81,7 +81,7 @@ public: Score_elem(); DECLARE_MY_RUNTIME_TYPEINFO; - Interval extent(Axis)const; + Interval extent (Axis)const; Interval width() const; Interval height() const; Status status() const; @@ -89,16 +89,16 @@ public: /** translate the symbol. The symbol does not have to be created yet. */ - void translate(Offset); + void translate (Offset); /** translate in one direction */ - void translate(Real, Axis); - Real relative_coordinate(Axis_group_element*, Axis)const; + void translate (Real, Axis); + Real relative_coordinate (Axis_group_element*, Axis)const; Offset absolute_offset()const; - Real absolute_coordinate(Axis)const; - Axis_group_element*common_group(Score_elem const* s, Axis a)const; + Real absolute_coordinate (Axis)const; + Axis_group_element*common_group (Score_elem const* s, Axis a)const; void add_processing(); void OK() const; @@ -114,13 +114,13 @@ public: */ void unlink(); void unlink_all(); - void substitute_dependency(Score_elem*,Score_elem*); - void remove_dependency(Score_elem*); + void substitute_dependency (Score_elem*,Score_elem*); + void remove_dependency (Score_elem*); /** add a dependency. It may be the 0 pointer, in which case, it is ignored. */ - void add_dependency(Score_elem* ); - void copy_dependencies(Score_elem const&); + void add_dependency (Score_elem*); + void copy_dependencies (Score_elem const&); /** junk the dependency array. Don't do derived stuff. */ @@ -158,8 +158,8 @@ protected: /// do calculations after determining horizontal spacing virtual void do_post_processing(); - virtual void do_substitute_dependency(Score_elem * , Score_elem *); - virtual void do_substitute_dependent(Score_elem *, Score_elem *); + virtual void do_substitute_dependency (Score_elem * , Score_elem *); + virtual void do_substitute_dependent (Score_elem *, Score_elem *); virtual void do_break_processing(); virtual void handle_broken_dependencies(); virtual void handle_prebroken_dependencies(); diff --git a/lily/include/score-grav.hh b/lily/include/score-grav.hh index 39941cda65..5cb3936bb5 100644 --- a/lily/include/score-grav.hh +++ b/lily/include/score-grav.hh @@ -31,7 +31,7 @@ class Score_engraver : Score_column* musical_column_l_; friend class Score; - void set_columns(Score_column*,Score_column*); + void set_columns (Score_column*,Score_column*); void typeset_all(); public: @@ -41,22 +41,22 @@ public: protected: /* Global_translator interface */ - virtual void set_score(Score * score_l); - virtual void prepare(Moment); + virtual void set_score (Score * score_l); + virtual void prepare (Moment); virtual void finish(); virtual void process(); - virtual int depth_i() const { return Global_translator::depth_i();} - virtual Translator* ancestor_l(int l) { return Global_translator::ancestor_l(l);} + virtual int depth_i() const { return Global_translator::depth_i ();} + virtual Translator* ancestor_l (int l) { return Global_translator::ancestor_l (l);} protected: /* Engraver_group_engraver interface */ virtual Staff_info get_staff_info()const; - virtual bool do_try_request(Request*); + virtual bool do_try_request (Request*); virtual void do_creation_processing(); virtual void do_removal_processing(); - virtual void announce_element(Score_elem_info); + virtual void announce_element (Score_elem_info); virtual void do_announces(); - virtual void typeset_element(Score_elem*elem_p); + virtual void typeset_element (Score_elem*elem_p); virtual Paper_def * paper() const; virtual void do_pre_move_processing(); }; diff --git a/lily/include/score-halign-grav.hh b/lily/include/score-halign-grav.hh index bfbc22f140..330cd310e2 100644 --- a/lily/include/score-halign-grav.hh +++ b/lily/include/score-halign-grav.hh @@ -16,7 +16,7 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; Score_horizontal_align_engraver(); protected: - virtual void acknowledge_element(Score_elem_info); + virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing(); }; #endif // SCORE_HALIGN_GRAV_HH diff --git a/lily/include/score-performer.hh b/lily/include/score-performer.hh index b0b584e72a..1a56148425 100644 --- a/lily/include/score-performer.hh +++ b/lily/include/score-performer.hh @@ -23,19 +23,19 @@ public: ~Score_performer(); protected: - virtual Translator* ancestor_l(int l); + virtual Translator* ancestor_l (int l); virtual int depth_i() const; virtual void finish(); - virtual void prepare(Moment mom); + virtual void prepare (Moment mom); virtual void process(); - virtual void set_score(Score* score_l); + virtual void set_score (Score* score_l); virtual void start(); virtual int get_tempo_i() const; - virtual void play(Audio_element* p); + virtual void play (Audio_element* p); private: - void header(Midi_stream&); + void header (Midi_stream&); Moment now_mom_; Audio_column* audio_column_l_; diff --git a/lily/include/score.hh b/lily/include/score.hh index 058fb173b0..e99e448a05 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -35,24 +35,24 @@ public: /// construction Score(); - Score(Score const&); + Score (Score const&); ~Score(); /// do everything except outputting to file void process(); /// output to file - void output(String fn); + void output (String fn); /// - void set(Midi_def* midi_p); + void set (Midi_def* midi_p); /// - void set(Paper_def* midi_p); + void set (Paper_def* midi_p); void print() const; private: - void run_translator(Global_translator*); + void run_translator (Global_translator*); void midi_output(); void paper_output(); @@ -63,7 +63,7 @@ private: void paper(); // utils: - PCursor create_cols(Moment, PCursor &last); + PCursor create_cols (Moment, PCursor &last); /** make the pcol_l_ fields of each Score_column point to the correct PCol, diff --git a/lily/include/scoreline.hh b/lily/include/scoreline.hh index abde4af7a2..9b9cf7d33f 100644 --- a/lily/include/scoreline.hh +++ b/lily/include/scoreline.hh @@ -20,16 +20,16 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; Line_of_score(); - void add(Score_elem *); + void add (Score_elem *); /// is #c# contained in #*this#? - bool contains_b(PCol const *c)const; + bool contains_b (PCol const *c)const; Link_array get_lines()const; - void set_breaking(Array const&); + void set_breaking (Array const&); protected: - virtual void break_into_pieces(bool); + virtual void break_into_pieces (bool); virtual Interval do_width()const; virtual void do_print() const; SCORE_ELEM_CLONE(Line_of_score); diff --git a/lily/include/script-column.hh b/lily/include/script-column.hh index b3d73aac95..e5b83984b7 100644 --- a/lily/include/script-column.hh +++ b/lily/include/script-column.hh @@ -13,20 +13,20 @@ #include "elem-group-item.hh" /** a struct for treating a group of noteheads (noteheads, stem - (chord) and scripts ) as a single entity. */ + (chord) and scripts) as a single entity. */ class Script_column : public Horizontal_vertical_group_item { protected: virtual void do_print() const; - virtual void do_substitute_dependency(Score_elem*, Score_elem*); + virtual void do_substitute_dependency (Score_elem*, Score_elem*); virtual void do_pre_processing() ; public: Link_array