From: Han-Wen Nienhuys Date: Wed, 19 Jun 2002 18:30:36 +0000 (+0000) Subject: * lily/grob.cc (programming_error): add Grob::programming_error with X-Git-Tag: release/1.5.62~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=95692a1ccc0f222354e08743ef3271f24528b2bf;p=lilypond.git * lily/grob.cc (programming_error): add Grob::programming_error with origin location. * lily/tuplet-bracket.cc (parallel_beam): robustness check, don't fail if a beam doesn't have stems. * lily/engraver-group-engraver.cc (do_announces): scary change in calling convention of create_grobs(): no create_grobs() call before acknowledge_grobs(). * lily/sequential-music-iterator.cc (skip): add support for grace notes. --- diff --git a/ChangeLog b/ChangeLog index 2fa4e6226c..7bd0c65d24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,21 @@ 2002-06-19 Han-Wen Nienhuys + * lily/grob.cc (programming_error): add programming_error with + origin location. + + * lily/tuplet-bracket.cc (parallel_beam): robustness check, don't + fail if a beam doesn't have stems. + + * lily/engraver-group-engraver.cc (do_announces): scary change in + calling convention of create_grobs(): no create_grobs() call + before acknowledge_grobs(). + + * lily/sequential-music-iterator.cc (skip): add support for grace + notes. + * lily/music.cc (Music): fix very subtle and nasty memory - corruption bug. + corruption bug. Typical symptom: "programming_error: Rhythmic_req + has no duration" * mutopia/claop.py: new file: CLA(O)P II by Peter Wallin. diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index 28717c25ae..694fca3513 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -141,6 +141,8 @@ Grace note do weird things with timing. Fragile. @lilypondfile[printfilename]{grace-sync.ly} +@lilypondfile[printfilename]{grace-part-combine.ly} + @lilypondfile[printfilename]{grace-bar-number.ly} diff --git a/input/regression/grace-part-combine.ly b/input/regression/grace-part-combine.ly new file mode 100644 index 0000000000..bec2319790 --- /dev/null +++ b/input/regression/grace-part-combine.ly @@ -0,0 +1,17 @@ +\header { + texidoc = "partcombiner and grace notes can go together" +} + +\score { + \context StaffGroup = group < + \context Staff = instrument < + \context Voice=one \partcombine Voice + \context Thread=one \notes \relative c'' { + c4 d e f \grace f16 g1 + } + \context Thread=two \notes \relative c' { + c4 d e2 g1 + } + > + > +} diff --git a/lily/engraver-group-engraver.cc b/lily/engraver-group-engraver.cc index 7bd0641015..518d277d59 100644 --- a/lily/engraver-group-engraver.cc +++ b/lily/engraver-group-engraver.cc @@ -125,7 +125,7 @@ Engraver_group_engraver::do_announces () dynamic_cast (t)->do_announces (); } - create_grobs_in_simple_children (); + // create_grobs_in_simple_children (); while (announce_info_arr_.size ()) { diff --git a/lily/global-translator.cc b/lily/global-translator.cc index a7fb3e0c3c..9ee578925a 100644 --- a/lily/global-translator.cc +++ b/lily/global-translator.cc @@ -5,6 +5,7 @@ (c) 1997--2002 Han-Wen Nienhuys */ +#include #include "debug.hh" #include "music.hh" @@ -97,8 +98,9 @@ Global_translator::run_iterator_on_me (Music_iterator * iter) } w = sneaky_insert_extra_moment (w); + + // printf ("proccing %s\n ", w.str().ch_C()); - // cout << "Proccing " << w << endl; if (first) diff --git a/lily/grob.cc b/lily/grob.cc index b61e151e34..08d263bcf6 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -791,7 +791,7 @@ Grob::fixup_refpoint (SCM smob) } void -Grob::warning (String s) +Grob::warning (String s)const { SCM cause = self_scm(); while (cause != SCM_EOL && !unsmob_music (cause)) @@ -806,7 +806,13 @@ Grob::warning (String s) } else ::warning (s); - +} + +void +Grob::programming_error (String s)const +{ + s = "Programming error: " + s; + warning (s); } diff --git a/lily/include/grob.hh b/lily/include/grob.hh index c01a5fe7a7..792cdf8f9e 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -70,7 +70,8 @@ public: SCM internal_get_grob_property (SCM) const; void internal_set_grob_property (SCM, SCM val); - void warning (String); + void warning (String)const; + void programming_error (String)const; void set_elt_pointer (const char*, SCM val); friend class Property_engraver; // UGHUGHUGH. diff --git a/lily/item.cc b/lily/item.cc index abae1689a6..d6214c5b6a 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -41,7 +41,7 @@ Item::breakable_b (Grob*me) return false; if (!dynamic_cast (me)) - programming_error ("only items can be breakable."); + me->programming_error ("only items can be breakable."); Item * i =dynamic_cast (me->get_parent (X_AXIS)); return (i) ? Item::breakable_b (i) : to_boolean (me->get_grob_property ("breakable")); diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc index 61cf029270..b3d0e5bc09 100644 --- a/lily/sequential-music-iterator.cc +++ b/lily/sequential-music-iterator.cc @@ -11,6 +11,8 @@ #include "sequential-music-iterator.hh" #include "music-list.hh" +Grace_fixup *copy_grace_fixups (Grace_fixup* src); +Grace_fixup *get_grace_fixups (SCM cursor); /* @@ -59,7 +61,7 @@ Sequential_music_iterator::Sequential_music_iterator () Sequential_music_iterator::Sequential_music_iterator (Sequential_music_iterator const &src) : Music_iterator (src) { - grace_fixups_ = src.grace_fixups_; + grace_fixups_ = copy_grace_fixups (src.grace_fixups_); cursor_ = src.cursor_; here_mom_ = src.here_mom_; if (src.iter_p_) @@ -74,17 +76,6 @@ Sequential_music_iterator::~Sequential_music_iterator () } -/* - - - if (start_music.grace) - here.grace -= start_music.grace - - last - if (len - - */ - Grace_fixup * get_grace_fixups (SCM cursor) { @@ -124,6 +115,23 @@ get_grace_fixups (SCM cursor) return head; } +Grace_fixup * +copy_grace_fixups (Grace_fixup* src) +{ + + Grace_fixup * head = 0; + Grace_fixup **dest = &head; + + while (src) + { + *dest = new Grace_fixup (*src); + dest = & (*dest)->next_; + src = src ->next_; + } + + return head; +} + void Sequential_music_iterator::construct_children () { @@ -264,16 +272,25 @@ Sequential_music_iterator::get_music (Moment until)const descending to child iterator contexts, because they might depend on \context specs and \translator changes being executed - TODO: build support for grace notes here. + TODO: check support for grace notes here. */ void Sequential_music_iterator::skip (Moment until) { while (ok ()) { - Moment l =iter_p_->music_length_mom (); - if (l >= until - here_mom_) - iter_p_->skip (until - here_mom_); + if (grace_fixups_ && + grace_fixups_->start_ == here_mom_ + && (grace_fixups_->start_ + grace_fixups_->length_ + + Moment (Rational (0), grace_fixups_->grace_start_) == until)) + { + /* + do the stuff/note/rest preceding a grace. + */ + iter_p_->skip (iter_p_->music_length_mom ()); + } + else if (iter_p_->music_length_mom () >= until - here_mom_) + iter_p_->skip (until - here_mom_ + iter_p_->music_start_mom ()); if (iter_p_->ok ()) return ; diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index e458287cc7..b58cd43d01 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -75,6 +75,12 @@ Tuplet_bracket::parallel_beam (Grob *me, Link_array const &cols, bool *equ Link_array beam_stems = Pointer_group_interface__extract_grobs (b1, (Grob*)0, "stems"); + if (beam_stems.size() == 0) + { + programming_error ("Beam under tuplet bracket has no stems!"); + *equally_long = 0; + return 0; + } *equally_long = (beam_stems[0] == s1 && beam_stems.top() == s2); return b1;