From d7ca28c7d6f84634bde2cf853eea7c87477b64d8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 17 Feb 1999 21:04:06 +0100 Subject: [PATCH] patch::: 1.1.31.jcn2: ughjeweg pl 31.jcn2 - fix: rat != float --- NEWS | 3 +++ VERSION | 2 +- flower/include/rational.hh | 6 +++++- flower/rational.cc | 25 ++++++++++++++++++++++++- input/bugs/auto-grace.ly | 19 +++++++++++++++++++ lily/auto-beam-engraver.cc | 19 ++++++++----------- lily/stem.cc | 13 +++++++++++++ lily/warn.cc | 2 +- ly/auto-beam-settings.ly | 1 + stepmake/NEWS | 3 +++ stepmake/VERSION | 2 +- 11 files changed, 79 insertions(+), 16 deletions(-) create mode 100644 input/bugs/auto-grace.ly diff --git a/NEWS b/NEWS index 3a4625f0a3..667a0ee353 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +pl 31.jcn2 + - fix: rat != float + pl 31.jcn1 - bf: slur-follow-music diff --git a/VERSION b/VERSION index f8e84f7152..071fe9bc5a 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=31 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=jcn2 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/flower/include/rational.hh b/flower/include/rational.hh index c8af749cda..3a2b8fff31 100644 --- a/flower/include/rational.hh +++ b/flower/include/rational.hh @@ -45,7 +45,9 @@ public: int den () const { return den_; } int num_i () const { return sign_ * num_; } int den_i () const { return den_; } - Rational truncated () const; + Rational trunc_rat () const; + Rational div_rat (Rational) const; + Rational mod_rat (Rational) const; void negate (); operator bool () const; operator int () const; @@ -64,6 +66,7 @@ public: Rational &operator /= (Rational); Rational &operator += (Rational); Rational &operator -= (Rational); + Rational &operator %= (Rational); static int compare (Rational const&, Rational const&); int sign () const; String str () const; @@ -73,6 +76,7 @@ IMPLEMENT_ARITHMETIC_OPERATOR (Rational, / ); IMPLEMENT_ARITHMETIC_OPERATOR (Rational, + ); IMPLEMENT_ARITHMETIC_OPERATOR (Rational, * ); IMPLEMENT_ARITHMETIC_OPERATOR (Rational, - ); +IMPLEMENT_ARITHMETIC_OPERATOR (Rational, % ); INSTANTIATE_COMPARE (Rational const&, Rational::compare); diff --git a/flower/rational.cc b/flower/rational.cc index bab115c9e3..ea9fb1ca46 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -34,7 +34,7 @@ operator << (ostream &o, Rational r) } Rational -Rational::truncated () const +Rational::trunc_rat () const { return Rational(num_ - (num_ % den_), den_); } @@ -90,6 +90,22 @@ Rational::operator - () const return r; } +Rational +Rational::div_rat (Rational div) const +{ + Rational r (*this); + r /= div; + return r.trunc_rat (); +} + +Rational +Rational::mod_rat (Rational div) const +{ + Rational r (*this); + r = (r / div - r.div_rat (div)) * div; + return r; +} + void Rational::normalise () { @@ -141,6 +157,13 @@ compare (Rational const &r, Rational const &s) return Rational::compare (r, s ); } +Rational & +Rational::operator %= (Rational r) +{ + *this = r.mod_rat (r); + return *this; +} + Rational & Rational::operator += (Rational r) { diff --git a/input/bugs/auto-grace.ly b/input/bugs/auto-grace.ly new file mode 100644 index 0000000000..1e858f0bc8 --- /dev/null +++ b/input/bugs/auto-grace.ly @@ -0,0 +1,19 @@ + +\version "1.0.14"; + +\score{ + \notes\relative c'' { + % set either property -> core dump: two autobeams? +% \property Voice.fontsize= "-2" + \property Voice.pletvisibility = 0 + + % strange staffs, but no core dump + \times 2/3 { [ c16 c c] } c4 c2 + } + \paper { + \translator { \VoiceContext +% \remove Auto_beam_engraver; + } + } +} + diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 9098cba68f..adb1e98b07 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -126,18 +126,13 @@ Auto_beam_engraver::consider_end_and_begin () begin_mom = begin_mult.to_rat (); } - /* UGH - Rational != Float - */ - Real f; + Rational r; if (end_mom) - f = fmod (time->whole_in_measure_, end_mom); + r = time->whole_in_measure_.mod_rat (end_mom); else - f = Moment (1); + r = Moment (1); - // enge floots - Real epsilon_f = Moment (1, 512); - if (beam_p_ && (abs (f) < epsilon_f)) + if (beam_p_ && !r) end_beam (); /* @@ -148,8 +143,8 @@ Auto_beam_engraver::consider_end_and_begin () return; if (begin_mom) - f = fmod (time->whole_in_measure_, begin_mom); - if (!beam_p_ && (!begin_mom || (abs (f) < epsilon_f))) + r = time->whole_in_measure_.mod_rat (begin_mom); + if (!beam_p_ && (!begin_mom || !r)) begin_beam (); } @@ -329,6 +324,7 @@ void Auto_beam_engraver::junk_beam () { assert (beam_p_); +#if 0 for (int i=0; i < beam_p_->stems_.size (); i++) { Stem* s = beam_p_->stems_[i]; @@ -337,6 +333,7 @@ Auto_beam_engraver::junk_beam () s->mult_i_ = 0; s->beam_l_ = 0; } +#endif beam_p_->unlink (); beam_p_ = 0; diff --git a/lily/stem.cc b/lily/stem.cc index 7b387d8d6d..900ee4019f 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -346,4 +346,17 @@ Stem::do_substitute_dependency (Score_element*o,Score_element*n) head_l_arr_.substitute (h, dynamic_cast(n)); if (Rest *r=dynamic_cast (o)) rest_l_arr_.substitute (r, dynamic_cast(n)); + if (Beam* b = dynamic_cast (o)) + { + if (b == beam_l_) + { + beam_l_ = dynamic_cast (n); + if (!beam_l_) + { + beams_i_drul_[LEFT] = 0; + beams_i_drul_[RIGHT] = 0; + mult_i_ = 0; + } + } + } } diff --git a/lily/warn.cc b/lily/warn.cc index b54f5a41aa..a8d50a36be 100644 --- a/lily/warn.cc +++ b/lily/warn.cc @@ -25,7 +25,7 @@ ostream *mlog (&cerr); void error_t (String const & s, Moment const & r) { - String t_mom = r.truncated ().str () + (r - r.truncated ()).str (); + String t_mom = r.trunc_rat ().str () + (r - r.trunc_rat ()).str (); String e=s+ " (t = " + t_mom + ")"; error (e); } diff --git a/ly/auto-beam-settings.ly b/ly/auto-beam-settings.ly index d52802108a..09113b139d 100644 --- a/ly/auto-beam-settings.ly +++ b/ly/auto-beam-settings.ly @@ -7,6 +7,7 @@ time3_2beamAutoEnd16 = "1/4"; time3_2beamAutoEnd32 = "1/8"; time3_4beamAutoBegin = "1/4"; time3_4beamAutoEnd8 = "3/4"; +time3_4beamAutoBegin32 = "1/8"; time3_4beamAutoEnd32 = "1/8"; time3_8beamAutoBegin = "1/8"; time3_8beamAutoEnd = "3/8"; diff --git a/stepmake/NEWS b/stepmake/NEWS index 6fc5bf84a7..23f770d131 100644 --- a/stepmake/NEWS +++ b/stepmake/NEWS @@ -1,3 +1,6 @@ +pl 70 + - GUILE config fixes (AF) + pl 69 - package_depth detection fix diff --git a/stepmake/VERSION b/stepmake/VERSION index e92135e2ec..32def17b69 100644 --- a/stepmake/VERSION +++ b/stepmake/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=StepMake MAJOR_VERSION=0 MINOR_VERSION=1 -PATCH_LEVEL=69 +PATCH_LEVEL=70 MY_PATCH_LEVEL= # use the above to send patches, always empty for released version: -- 2.39.5