From ef48d78cf655c5ab12b707c5f2d5ae423564da9a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 4 Aug 2005 13:36:43 +0000 Subject: [PATCH] * lily/parser.yy (simple_string): allow \new STRING_IDENTIFIER. * flower/rational.cc (operator +): prevent overflow. This fixes heavily nested tuplets. --- ChangeLog | 5 +++++ flower/rational.cc | 5 +++-- lily/parser.yy | 3 +++ lily/tuplet-bracket.cc | 6 +++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bffb1b1393..0a9c37ee4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2005-08-04 Han-Wen Nienhuys + * lily/parser.yy (simple_string): allow \new STRING_IDENTIFIER. + + * flower/rational.cc (operator +): prevent overflow. This fixes + heavily nested tuplets. + * lily/auto-beam-engraver.cc (derived_mark): new method. Yes. We have to protect even those unlikely to be corrupted data members. diff --git a/flower/rational.cc b/flower/rational.cc index f8ac098697..9ab8dcc4cd 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -171,8 +171,9 @@ Rational::operator += (Rational r) *this = r; else { - int n = sign_ * num_ * r.den_ + r.sign_ * den_ * r.num_; - int d = den_ * r.den_; + int lcm = (den_ / gcd (r.den_, den_)) * r.den_; + int n = sign_ * num_ * (lcm / den_) + r.sign_ * r.num_ * (lcm / r.den_); + int d = lcm; sign_ = ::sign (n) * ::sign (d); num_ = abs (n); den_ = abs (d); diff --git a/lily/parser.yy b/lily/parser.yy index 85b2fb1cb7..5662c99439 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1513,6 +1513,9 @@ simple_string: STRING { | LYRICS_STRING { $$ = $1; } + | STRING_IDENTIFIER { + $$ = $1; + } ; scalar: string { diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index bac817dddd..bb55ca2d01 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -386,6 +386,9 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) commony = common_refpoint_of_array (tuplets, commony, Y_AXIS); Grob *commonx = common_refpoint_of_array (columns, me, X_AXIS); commonx = common_refpoint_of_array (tuplets, commonx, Y_AXIS); + commonx = commonx->common_refpoint (me->get_bound (LEFT), X_AXIS); + commonx = commonx->common_refpoint (me->get_bound (RIGHT), X_AXIS); + Interval staff; if (Grob *st = Staff_symbol_referencer::get_staff_symbol (me)) @@ -662,7 +665,8 @@ ADD_INTERFACE (Tuplet_bracket, "tuplet-bracket-interface", "A bracket with a number in the middle, used for tuplets. " "When the bracket spans a line break, the value of " - "@code{break-overshoot} determines how far it extends beyond the staff. " + "@code{break-overshoot} determines how far it extends " + "beyond the staff. " "At a line break, the markups in the @code{edge-text} are printed " "at the edges. ", -- 2.39.2