X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsimple-spacer.cc;h=cf4fd5849e35601ad8cf839394d7f6d6ba407c8e;hb=5d84bfad4626892bcffd05adcced53c8a2329047;hp=ce587c5fdd644080b336783f6c151a9498a488cd;hpb=90d3233da87b372e02690978f89b2add3863fba6;p=lilypond.git diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index ce587c5fdd..cf4fd5849e 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -32,8 +32,6 @@ #include "spring.hh" #include "warn.hh" -ADD_SMOB_INIT (Simple_spacer); - /* A simple spacing constraint solver. The approach: @@ -197,7 +195,8 @@ Simple_spacer::expand_line () if (inv_hooke == 0.0) /* avoid division by zero. If springs are infinitely stiff */ inv_hooke = 1e-6; /* then report a very large stretching force */ - assert (cur_len <= line_len_); + if (cur_len > (1 + 1e-6) * line_len_) + programming_error ("misuse of expand_line"); return (line_len_ - cur_len) / inv_hooke + force_; } @@ -221,8 +220,8 @@ Simple_spacer::compress_line () fits_ = true; - assert (line_len_ <= cur_len); - + if (line_len_ > (1 + 1e-6) * cur_len) + programming_error ("misuse of compress_line"); vector sorted_springs = springs_; sort (sorted_springs.begin (), sorted_springs.end (), greater ()); @@ -250,7 +249,9 @@ Simple_spacer::compress_line () /* Paranoia check. */ - assert (fabs (configuration_length (cur_force) - cur_len) < 1e-6); + if (fabs (configuration_length (cur_force) - cur_len) > 1e-6 * cur_len) + programming_error (to_string ("mis-predicted force, %.6f ~= %.6f", + cur_len, configuration_length(cur_force))); return cur_force; } @@ -382,7 +383,7 @@ get_column_description (vector const &cols, vsize col_index, bool line_s for (SCM s = Spaceable_grob::get_minimum_distances (col); scm_is_pair (s); s = scm_cdr (s)) { - Grob *other = Grob::unsmob (scm_caar (s)); + Grob *other = unsmob (scm_caar (s)); vsize j = binary_search (cols, other, Paper_column::less_than, col_index); if (j != VPOS) { @@ -469,7 +470,7 @@ get_line_forces (vector const &columns, force[b * breaks.size () + c] = infinity_f; break; } - if (end < cols.size () && cols[end].break_permission_ == force_break) + if (end < cols.size () && scm_is_eq (cols[end].break_permission_, force_break)) break; } }