From 187afbfe7c9c201ddfecbbe8c4463b406cea5496 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 02:04:06 +0000 Subject: [PATCH] lilypond-1.5.21 --- lily/gourlay-breaking.cc | 62 ++++++++++++++++---------------- lily/include/lily-guile.hh | 10 ++++-- lily/unfolded-repeat-iterator.cc | 2 +- 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 78e5c2fa04..86914fcd0e 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -59,16 +59,12 @@ Gourlay_breaking::do_solve () const Array breaks = find_break_indices (); - optimal_paths.set_size (breaks.size ()); - Break_node first_node ; - - optimal_paths[0] = first_node; - int break_idx=1; + optimal_paths.push (first_node); Real worst_force = 0.0; - for (; break_idx< breaks.size (); break_idx++) + for ( int break_idx=1; break_idx< breaks.size (); break_idx++) { /* start with a short line, add measures. At some point @@ -96,24 +92,15 @@ Gourlay_breaking::do_solve () const sp->solve (&cp); delete sp; - if (cp.force_f_ > worst_force) - worst_force = cp.force_f_; + if (fabs (cp.force_f_) > worst_force) + worst_force = fabs (cp.force_f_); /* We remember this solution as a "should always work solution", in case everything fucks up. */ if (start_idx == break_idx - 1) backup_sol = cp; - if (!cp.satisfies_constraints_b_) - { - /* - If it doesn't satisfy constraints, we make this one - really unattractive. - */ - cp.force_f_ += worst_force; - cp.force_f_ *= 10; - } - + Real this_demerits; if (optimal_paths[start_idx].demerits_f_ >= infinity_f) @@ -137,28 +124,30 @@ Gourlay_breaking::do_solve () const break ; } - int prev =break_idx - 1; + + Break_node bnod; if (minimal_start_idx < 0) { - optimal_paths[break_idx].demerits_f_ = infinity_f; - optimal_paths[break_idx].line_config_ = backup_sol; + bnod.demerits_f_ = infinity_f; + bnod.line_config_ = backup_sol; + bnod.prev_break_i_ = break_idx - 1; } else { - prev = minimal_start_idx; - optimal_paths[break_idx].line_config_ = minimal_sol; - optimal_paths[break_idx].demerits_f_ = minimal_demerits; + bnod.prev_break_i_ = minimal_start_idx; + bnod.demerits_f_ = minimal_demerits; + bnod.line_config_ = minimal_sol; } - optimal_paths[break_idx].prev_break_i_ = prev; - optimal_paths[break_idx].line_i_ = optimal_paths[prev].line_i_ + 1; - + bnod.line_i_ = optimal_paths[bnod.prev_break_i_].line_i_ + 1; + optimal_paths.push (bnod); + if (! (break_idx % HAPPY_DOTS_I)) progress_indication (String ("[") + to_str (break_idx) + "]"); } /* do the last one */ - if (break_idx % HAPPY_DOTS_I) - progress_indication (String ("[") + to_str (break_idx) + "]"); + if (breaks.size () % HAPPY_DOTS_I) + progress_indication (String ("[") + to_str (breaks.size()) + "]"); progress_indication ("\n"); @@ -214,7 +203,20 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev, } } - return abs (this_one.force_f_) + abs (prev.force_f_ - this_one.force_f_) + Real demerit = abs (this_one.force_f_) + abs (prev.force_f_ - this_one.force_f_) + break_penalties; + + + if (!this_one.satisfies_constraints_b_) + { + /* + If it doesn't satisfy constraints, we make this one + really unattractive. + */ + demerit += 10; + demerit *= 100; + } + + return demerit; } diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index e67293e06f..e2a74c779f 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -91,6 +91,12 @@ SCM ly_truncate_list (int k, SCM l ); #define CACHE_SYMBOLS #ifdef CACHE_SYMBOLS + +/* + We don't use gh_symbol2scm directly, since it has const-correctness + problems in GUILE 1.3.4 + + */ SCM my_gh_symbol2scm (const char* x); // #warning: CACHE_SYMBOLS @@ -108,12 +114,12 @@ SCM my_gh_symbol2scm (const char* x); SCM value = cached; /* We store this one locally, since G++ -O2 fucks up else */ \ if ( __builtin_constant_p ((x)))\ { if (!cached)\ - value = cached = scm_gc_protect_object (my_gh_symbol2scm((char*) (x)));\ + value = cached = scm_gc_protect_object (my_gh_symbol2scm((x)));\ } else\ value = gh_symbol2scm ((char*) (x)); \ value; }) #else -inline SCM ly_symbol2scm(char const* x) { return gh_symbol2scm((char*)x); } +inline SCM ly_symbol2scm(char const* x) { return gh_symbol2scm((x)); } #endif diff --git a/lily/unfolded-repeat-iterator.cc b/lily/unfolded-repeat-iterator.cc index 7dd93bd1dc..7e8b12fbcd 100644 --- a/lily/unfolded-repeat-iterator.cc +++ b/lily/unfolded-repeat-iterator.cc @@ -289,7 +289,7 @@ void Unfolded_repeat_iterator::add_repeat_command (SCM what) { SCM reps = ly_symbol2scm ("repeatCommands"); - SCM current_reps = report_to_l ()->get_property (reps); + SCM current_reps = report_to_l ()->internal_get_property (reps); Translator_group * where = report_to_l ()->where_defined (reps); if (where -- 2.39.5