]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.59
authorfred <fred>
Tue, 26 Mar 2002 22:23:38 +0000 (22:23 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:23:38 +0000 (22:23 +0000)
13 files changed:
BUGS
input/test/collisions.ly
lily/break-align-item.cc
lily/col-info.cc
lily/colhpos.cc
lily/gourlay-breaking.cc
lily/include/col-info.hh
lily/include/colhpos.hh
lily/include/ly-symbols.hh
lily/include/spring-spacer.hh
lily/line-of-score.cc
lily/spring-spacer.cc
lily/word-wrap.cc

diff --git a/BUGS b/BUGS
index 59f9f827ab5726b77eedefc94d8ce4427bc08891..5fe9ab69ee795d1ab2b08e43e4cb6330eb621d6a 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -31,6 +31,17 @@ Lilypond 1.1.35-1.1.51,...:  Wierd errors in guile scm_gc_mark ()
 
 Some bugs may be captured in input/bugs/*y
 
+[Linux i386, RedHat 5.2 with updates to 6.0]
+
+Compiling with 
+
+       configure --disable-checking --enable-printing --disable-optimise --disable-debugging
+
+results in core dumps, during parsing of init files. Cause unknown.
+Solution: use
+
+       --enable-checking and --enable-optimize
+
 [Linux libg++ 2.7]
 
 LilyPond occasionally crashes while parsing the initialisation files.
index 1e8796cc5fd31080063e48ce515b8f70953006a4..370ce9463f8aa8700b278102ca4d94329f96ccfc 100644 (file)
@@ -24,14 +24,21 @@ threevoice = \context Staff \notes <
        \context Voice=iii { \stemdown c4 d e d c d es }
 >
 
+chordstest = \context Staff \notes <
+       \context Voice = i \relative c {
+               \stemup e4 dis c f g f a b b
+       }
+       \context Voice = ii \relative c {
+               \stemdown <a4 c> <a4 c> <a4 e'> <a4 c> <e' a> <e a> <e a> <a c> <a d>
+       }
+>
+
 \score{
        \notes \transpose c'' {  \twovoice  
        \twovoicesteminvert 
-       \threevoice  
-
+       \threevoice
+       \break \chordstest
        }
        
-
-       
 %      \midi { \tempo 4:80 }
 }
index 5f5079dad550320239e4733f208a3ec4ddfc85d9..12aa5e08a0664941db2605062d04261bef060628 100644 (file)
@@ -108,13 +108,16 @@ Break_align_item::do_pre_processing()
 
   Real pre_space = elems[0]->extent (X_AXIS)[LEFT];
   Real spring_len = elems.top ()->extent (X_AXIS)[RIGHT];
+  Real stretch_distance =0.;  
   if (SCM_CAR (symbol_list) == extra_space_scm_sym)
     {
       spring_len += dists.top ();
+      stretch_distance = dists.top ();
     }
   else if (SCM_CAR (symbol_list) == minimum_space_scm_sym)
     {
       spring_len = spring_len >? dists.top ();
+      stretch_distance = spring_len;
     }
 
 
@@ -124,6 +127,10 @@ Break_align_item::do_pre_processing()
   column_l ()->set_elt_property (extra_space_scm_sym,
                                 scm_cons (gh_double2scm (pre_space),
                                           gh_double2scm (spring_len)));
+
+  column_l ()->set_elt_property (stretch_distance_scm_sym,
+                                gh_double2scm (stretch_distance));
+                                
 }
 
 
index 47d9c69c33f26bb8d9abcfd659ec97bf9115fd88..2ebfd15d4f06ab5313a04a9bb18c25efe54bce7e 100644 (file)
@@ -33,7 +33,6 @@ Column_info::Column_info (Paper_column *col_l, Real const *fixed_C)
 {
   if (fixed_C)
     fixpos_p_.set_l (fixed_C);
-  ugh_b_ = false;
   pcol_l_ = col_l;
   width_ = pcol_l_->extent(X_AXIS);
   if (width_.empty_b())
@@ -43,7 +42,6 @@ Column_info::Column_info (Paper_column *col_l, Real const *fixed_C)
 
 Column_info::Column_info()
 {
-  ugh_b_ = false;
   pcol_l_ =0;
 }
 
index 1e0a971a12152bce64c6a88e58438ed933fb4ae7..8d82c2c06d1f58c2360e0f47c6af8c4c0e75d39f 100644 (file)
@@ -15,7 +15,6 @@
 Column_x_positions::Column_x_positions()
 {
   energy_f_ = infinity_f;
-  ugh_b_ = false;
   satisfies_constraints_b_ = false;
   spacer_l_ =0;
 }
@@ -28,7 +27,7 @@ Column_x_positions::~Column_x_positions()
 void
 Column_x_positions::add_paper_column (Paper_column*c)
 {
-  cols.push (c);
+  cols_.push (c);
 }
 
 void
@@ -36,8 +35,8 @@ Column_x_positions::print() const
 {
 #ifndef NPRINT
   DOUT << "energy : " << energy_f_ << '\n';
-  DOUT << "line of " << config.size() << " cols\n";
-  Vector v (config);
+  DOUT << "line of " << config_.size() << " cols\n";
+  Vector v (config_);
   DOUT << v;
 #endif
 }
@@ -54,8 +53,7 @@ void
 Column_x_positions::set_stupid_solution(Vector v)
 {
   energy_f_ = infinity_f;
-  ugh_b_ = true;
-  config = v;
+  config_ = v;
 }
 
 void
index 284f1e83b308063b72ff938cf8c31a5ead2d1d04..cc494cfa8896f26b44de7bbad0feddf99547ef2b 100644 (file)
@@ -90,13 +90,13 @@ Gourlay_breaking::do_solve () const
            break;
            
          Column_x_positions approx;
-         approx.cols = line;
+         approx.cols_ = line;
            
          approx.spacer_l_ = generate_spacing_problem (line, 
            pscore_l_->paper_l_->line_dimensions_int (optimal_paths[start_idx].line_i_));
          spacer_p_list.append (new Killing_cons<Line_spacer> (approx.spacer_l_,0));
 
-         ( (Break_algorithm*)this)->approx_stats_.add (approx.cols);
+         ( (Break_algorithm*)this)->approx_stats_.add (approx.cols_);
          approx.approximate_solve_line ();
            
          if  (approx.energy_f_  > energy_bound_f_)
@@ -124,7 +124,7 @@ Gourlay_breaking::do_solve () const
          if (!candidate_lines[j].satisfies_constraints_b_) 
            {
              candidate_lines[j].solve_line ();
-             ( (Break_algorithm*)this)->exact_stats_.add (candidate_lines[j].cols);
+             ( (Break_algorithm*)this)->exact_stats_.add (candidate_lines[j].cols_);
            }
            
          Real this_energy 
@@ -171,7 +171,7 @@ Gourlay_breaking::do_solve () const
       assert (i > optimal_paths[i].prev_break_i_);
 
       // there was no "feasible path"
-      if (!optimal_paths[i].line_config_.config.size ()) {
+      if (!optimal_paths[i].line_config_.config_.size ()) {
        final_breaks.set_size (0);
        break;
       }
index d63c92b9ab65f3344146c75d03a6ada7408a6f42..8aea10dbc4ace847f35458621573d4214f026c15 100644 (file)
@@ -39,7 +39,7 @@ struct Column_info {
   bool ugh_b_;         
 
   Drul_array< Array<Spacer_rod> > rods_;
-  Drul_array< Array<Spacer_spring> > springs_;  
+  //  Drul_array< Array<Spacer_spring> > springs_;  
   
   Column_info();
   Column_info (Paper_column *,Real const *);
index 8b9d34b614e2ec06eeb1545f7e3a520733d6a2d1..98b808a5bb790db67507f8343a5c52f829707e59 100644 (file)
@@ -14,10 +14,9 @@ typedef Link_array<Paper_column>  Line_of_cols;
 
 struct Column_x_positions {
   Line_spacer * spacer_l_;
-  bool ugh_b_;
-  Line_of_cols error_col_l_arr_;
-  Line_of_cols cols;
-  Array<Real> config;
+  Line_of_cols cols_;
+  Array<Real> config_;
+  
   Real energy_f_;
   bool satisfies_constraints_b_;
 
index 25a2b8b38b2b0301f435990887ea69467be5245c..28d10c77459cf807dab07f58f9b5835f91e60e70 100644 (file)
@@ -64,6 +64,7 @@ DECLARE_LY_SYMBOL(rulesym);
 DECLARE_LY_SYMBOL(rulethickness);
 DECLARE_LY_SYMBOL(script_priority);
 DECLARE_LY_SYMBOL(staffheight);
+DECLARE_LY_SYMBOL(stretch_distance);
 DECLARE_LY_SYMBOL(style);
 DECLARE_LY_SYMBOL(text);
 DECLARE_LY_SYMBOL(transparent);
index de2d4b4aeea608b4c6386d1c10bc5280cddfdf64..354b664fb6fab29310953ebc9ac06c30a6b00c94 100644 (file)
@@ -51,11 +51,8 @@ private:
   Spring_spacer (Spring_spacer const&s);
   Cons<Idealspacing> *ideal_p_list_;
   Array<Column_info> cols_;
-  Array<Column_info> loose_col_arr_;
 
   
-  /// mark column #i# as being loose.
-  void loosen_column (int i);
   /// the index of #c# in #cols#
   int col_id (Paper_column const *c) const;
 
@@ -74,7 +71,6 @@ private:
 
 
   void handle_loose_cols();
-  void position_loose_cols (Vector &) const;
   bool try_initial_solution_and_tell (Vector&)const;
   Vector try_initial_solution() const;
 
@@ -82,7 +78,6 @@ private:
 
   Score_column* scol_l (int);
   void connect (int i,int j, Real,Real);
-  Line_of_cols error_pcol_l_arr() const;
   Real calculate_energy_f (Vector) const;
 public:
   static Line_spacer *constructor();
index be7a5e8dac47fcf806b2a81e2d3759e200ae5fe5..c53a33a9e8cc4f7f6647015f2dffa7db0e95ec03 100644 (file)
@@ -28,8 +28,8 @@ Line_of_score::contains_b (Paper_column const* c) const
 Line_of_score*
 Line_of_score::set_breaking (Array<Column_x_positions> const &breaking, int j) const
 {
-  const Link_array<Paper_column> &curline (breaking[j].cols);
-  const Array<Real> &config (breaking[j].config);
+  const Link_array<Paper_column> &curline (breaking[j].cols_);
+  const Array<Real> &config (breaking[j].config_);
   Line_of_score *line_l=0;
 
   line_l = dynamic_cast <Line_of_score*> (clone());
index 79ec147d692217b43943ffc4b0da2cac16544c03..9c1f6881d6e9445e3674ca8aeeae12aa8581ed53 100644 (file)
@@ -54,8 +54,6 @@ Spring_spacer::OK() const
 #ifndef NDEBUG
   for (int i = 1; i < cols_.size(); i++)
     assert (cols_[i].rank_i_ > cols_[i-1].rank_i_);
-  for (int i = 1; i < loose_col_arr_.size(); i++)
-    assert (loose_col_arr_[i].rank_i_ > loose_col_arr_[i-1].rank_i_);
 #endif
 }
 
@@ -78,72 +76,17 @@ Spring_spacer::handle_loose_cols()
   for (int i=1; i < fixed.size(); i++)
     connected.connect (fixed[i-1], fixed[i]);
 
+  /*
+    connect unconnected columns with distances of 1.0; 
+   */
   for (int i = cols_.size(); i--;)
     {
       if (! connected.equiv (fixed[0], i))
        {
-         warning (_f ("unconnected column: %d", i));
-         loosen_column (i);
+         connected.connect (i-1, i);
+         connect (i-1, i, 1.0, 1.0);
        }
     }
-  OK();
-}
-
-
-/**
-  Guess a stupid position for loose columns.  Put loose columns at
-  regular distances from enclosing calced columns
-  */
-void
-Spring_spacer::position_loose_cols (Vector &sol_vec) const
-{
-  if (!loose_col_arr_.size())
-    return ;
-  assert (sol_vec.dim());
-  Array<bool> fix_b_arr;
-  fix_b_arr.set_size (cols_.size() + loose_col_arr_.size ());
-  Real utter_right_f=-infinity_f;
-  Real utter_left_f =infinity_f;
-  for (int i=0; i < loose_col_arr_.size(); i++)
-    {
-      fix_b_arr[loose_col_arr_[i].rank_i_] = false;
-    }
-  for (int i=0; i < cols_.size(); i++)
-    {
-      int r= cols_[i].rank_i_;
-      fix_b_arr[r] = true;
-      utter_right_f = utter_right_f >? sol_vec (i);
-      utter_left_f = utter_left_f <? sol_vec (i);
-    }
-  Vector v (fix_b_arr.size());
-  int j =0;
-  int k =0;
-  for (int i=0; i < v.dim(); i++)
-    {
-      if (fix_b_arr[i])
-       {
-         assert (cols_[j].rank_i_ == i);
-         v (i) = sol_vec (j++);
-       }
-      else
-       {
-         Real left_pos_f =
-           (j>0) ?sol_vec (j-1) : utter_left_f;
-         Real right_pos_f =
-           (j < sol_vec.dim()) ? sol_vec (j) : utter_right_f;
-         int left_rank = (j>0) ? cols_[j-1].rank_i_ : 0;
-         int right_rank = (j<sol_vec.dim()) ? cols_[j].rank_i_ : sol_vec.dim ();
-
-         int d_r = right_rank - left_rank;
-         Column_info loose=loose_col_arr_[k++];
-         int r = loose.rank_i_ ;
-         assert (r > left_rank && r < right_rank);
-
-         v (i) =  (r - left_rank)*left_pos_f/ d_r +
-           (right_rank - r) *right_pos_f /d_r;
-       }
-    }
-  sol_vec = v;
 }
 
 bool
@@ -318,7 +261,7 @@ Spring_spacer::lower_bound_solution (Column_x_positions*positions) const
 
   DOUT << "Lower bound sol: " << solution_vec;
   positions->energy_f_ = calculate_energy_f (solution_vec);
-  positions->config = solution_vec;
+  positions->config_ = solution_vec;
   positions->satisfies_constraints_b_ = check_constraints (solution_vec);
 }
 
@@ -350,10 +293,8 @@ Spring_spacer::solve (Column_x_positions*positions) const
        {
          WARN << _ ("solution doesn't satisfy constraints") << '\n' ;
        }
-      position_loose_cols (solution_vec);
       positions->energy_f_ = calculate_energy_f (solution_vec);
-      positions->config = solution_vec;
-      positions->error_col_l_arr_ = error_pcol_l_arr();
+      positions->config_ = solution_vec;
     }
   else
     {
@@ -402,68 +343,13 @@ Spring_spacer::add_column (Paper_column  *col, bool fixed, Real fixpos)
        continue;
       
       if (cols_[idx].pcol_l_ != cr.other_l_)
-           continue;
-      
-      Real d  = cr.distance_f_;
-      if (fabs (d) < EPS)
-       {
-         connect (idx, this_rank, cr.distance_f_, cr.strength_f_); // large strength. 
-       }
-      else
-       connect (idx, this_rank, cr.distance_f_,
-                cr.strength_f_ / cr.distance_f_);
+       continue;
+      connect (idx, this_rank, cr.distance_f_, cr.strength_f_);
     }
       
   cols_.push (c);
 }
 
-Line_of_cols
-Spring_spacer::error_pcol_l_arr() const
-{
-  Link_array<Paper_column> retval;
-  for (int i=0; i< cols_.size(); i++)
-    if (cols_[i].ugh_b_)
-      retval.push (cols_[i].pcol_l_);
-  for (int i=0;  i < loose_col_arr_.size(); i++)
-    {
-      retval.push (loose_col_arr_[i].pcol_l_);
-    }
-  return retval;
-}
-
-/*
-  Ugh. Should junk this.
- */
-void
-Spring_spacer::loosen_column (int idx)
-{
-  Column_info c=cols_.get (idx);
-
-  Cons<Idealspacing> **pp = &ideal_p_list_;
-
-  while (*pp)
-    {
-      Idealspacing *j = (*pp)->car_;
-      if (j->cols_drul_[LEFT] == idx|| j->cols_drul_[RIGHT] == idx)
-       {
-         delete remove_cons (pp);
-       }
-      else
-       {
-         pp = &(*pp)->next_;
-       }
-    }
-  c.ugh_b_ = true;
-
-  int j=0;
-  for (; j < loose_col_arr_.size(); j++)
-    {
-      if (loose_col_arr_[j].rank_i_ > c.rank_i_)
-       break;
-    }
-  loose_col_arr_.insert (c,j);
-}
-
 
 void
 Spring_spacer::print() const
index f9c7ea8dfa5c5bcf215f42537ad2a2dbef556e34..81a407450ebc87fb7c8003e82fa83f8e1b186fe5 100644 (file)
@@ -66,13 +66,13 @@ Word_wrap::do_solve () const
          Paper_column* precol = dynamic_cast<Paper_column*>(pre);
          current.add_paper_column (precol);
 
-         current.spacer_l_ = generate_spacing_problem (current.cols, 
+         current.spacer_l_ = generate_spacing_problem (current.cols_
            pscore_l_->paper_l_->line_dimensions_int (line_no));
 
          // try to solve
-         if (!feasible (current.cols))
+         if (!feasible (current.cols_))
            {
-             if (!minimum.cols.size ())
+             if (!minimum.cols_.size ())
                {
                  warning (_ ("ugh, this measure is too long") 
                    + ", " + _f ("breakpoint: %d", break_idx) 
@@ -116,7 +116,7 @@ Word_wrap::do_solve () const
 
 
          // add nobreak version of breakable column
-         current.cols.top ()=breakpoints[break_idx];
+         current.cols_.top ()=breakpoints[break_idx];
          curcol_idx ++;
          break_idx++;
        }