From: Han-Wen Nienhuys Date: Fri, 30 Aug 2002 23:47:17 +0000 (+0000) Subject: * lily/script-column.cc (before_line_breaking): use stable sorting X-Git-Tag: release/1.6.1~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a172959833e0f111af14e511c87427733aa7807b;p=lilypond.git * lily/script-column.cc (before_line_breaking): use stable sorting algorithm to preserve script ordering. (grob_script_priority_less): new function * lily/script-engraver.cc (process_music): * lily/text-engraver.cc (process_acknowledged_grobs): * lily/fingering-engraver.cc (make_script): don't use direction for script-priority. * scripts/ly2dvi.py (run_lilypond): don't exit if LilyPond fails, but try to assemble the files anyway. * input/regression/prefatory-empty-spacing.ly: new file. --- diff --git a/ChangeLog b/ChangeLog index d33ae4dd69..6056917844 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2002-08-31 Han-Wen Nienhuys + * lily/script-column.cc (before_line_breaking): use stable sorting + algorithm to preserve script ordering. + (grob_script_priority_less): new function + + * lily/script-engraver.cc (process_music): + * lily/text-engraver.cc (process_acknowledged_grobs): + * lily/fingering-engraver.cc (make_script): don't use direction + for script-priority. + + * scripts/ly2dvi.py (run_lilypond): don't exit if LilyPond fails, + but try to assemble the files anyway. + + * input/regression/prefatory-empty-spacing.ly: new file. + * lily/break-align-interface.cc (do_alignment): translate last break-align-group if it is invisible/empty. diff --git a/input/regression/prefatory-empty-spacing.ly b/input/regression/prefatory-empty-spacing.ly new file mode 100644 index 0000000000..2c3fb678aa --- /dev/null +++ b/input/regression/prefatory-empty-spacing.ly @@ -0,0 +1,13 @@ + +\header { + +texidoc =" The A is atop an invisible barline. The barline +although invisible, is also translated because it is the last one of +the break alignment." + +} + +\score{ \notes { +a a a a \break +\mark A +a a a a}} diff --git a/input/regression/script-stacked.ly b/input/regression/script-stacked.ly index aabf7a0236..70e7e37057 100644 --- a/input/regression/script-stacked.ly +++ b/input/regression/script-stacked.ly @@ -1,6 +1,7 @@ \version "1.5.68" \header { -texidoc = "Scripts may b4e stacked." +texidoc = "Scripts may be stacked." } -\score { \notes { c''->-. } } + +\score { \notes { c'''->-. } } diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc index 120b580e28..ee6612cc4e 100644 --- a/lily/fingering-engraver.cc +++ b/lily/fingering-engraver.cc @@ -192,8 +192,8 @@ Fingering_engraver::make_script (Direction d, Music *r,Axis a, int i) if (gh_number_p (s)) priority = gh_scm2int (s); - /* Make sure they're in order of user input by adding index i. */ - priority += d*i; + /* See script-engraver.cc */ + priority += i; fingering->set_grob_property ("script-priority", gh_int2scm (priority)); diff --git a/lily/script-column.cc b/lily/script-column.cc index deab16f026..2a6e38bea4 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -23,55 +23,59 @@ Script_column::add_staff_sided (Grob *me, Item *i) me->add_dependency (i); } -static int -staff_side_compare (Grob * const &i1, - Grob * const &i2) +LY_DEFINE(grob_script_priority_less, + "ly-grob-script-priority-less", 2, 0, 0, + (SCM a, SCM b), + "Compare two grobs by script priority. For internal use.") { + Grob * i1 = unsmob_grob (a); + Grob* i2 = unsmob_grob (b); + SCM p1 = i1->get_grob_property ("script-priority"); SCM p2 = i2->get_grob_property ("script-priority"); - return gh_scm2int (p1) - gh_scm2int (p2); + return gh_scm2int (p1) < gh_scm2int (p2) ? SCM_BOOL_T : SCM_BOOL_F; } -MAKE_SCHEME_CALLBACK (Script_column,before_line_breaking,1); + +MAKE_SCHEME_CALLBACK (Script_column,before_line_breaking,1); SCM Script_column::before_line_breaking (SCM smob) { Grob* me = unsmob_grob (smob); - Drul_array > arrs; + Drul_array scripts (SCM_EOL, SCM_EOL); Link_array staff_sided = Pointer_group_interface__extract_grobs (me, (Grob*)0, "scripts"); for (int i=0; i < staff_sided.size (); i++) { - Direction d = Side_position_interface::get_direction (staff_sided[i]); + Grob* g = staff_sided[i]; + Direction d = Side_position_interface::get_direction (g); if (!d) { programming_error ( "No direction for script?"); d = DOWN; - staff_sided[i]->set_grob_property ("direction", gh_int2scm (d)); + g->set_grob_property ("direction", gh_int2scm (d)); } - arrs[d].push (staff_sided[i]); + scripts[d] = scm_cons (g->self_scm(), scripts[d]); } Direction d = DOWN; do { - Link_array &arr - (arrs[d]); + SCM ss = scm_reverse_x (scripts[d], SCM_EOL); - arr.sort (staff_side_compare); + ss = scm_stable_sort_x (ss, grob_script_priority_less_proc); Grob * last = 0; - for (int i=0; i < arr.size (); i++) + for (SCM s = ss; gh_pair_p (s); s = gh_cdr (s)) { - + Grob* g = unsmob_grob (gh_car (s)); if (last) - Side_position_interface::add_support (arr[i],last); - - arr[i]->set_grob_property ("script-priority", SCM_EOL); - last = arr[i]; + Side_position_interface::add_support (g,last); + + last = g; } } while (flip (&d) != DOWN); diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 455ab600eb..aa16108edd 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -89,8 +89,11 @@ Script_engraver::process_music () if (gh_number_p (s)) priority = gh_scm2int (s); - /* Make sure they're in order of user input by adding index i. */ - priority += i * (to_dir (force_dir) ? to_dir (force_dir) : 1); + /* Make sure they're in order of user input by adding index i. + Don't use the direction in this priority. Smaller means closer + to the head. + */ + priority += i; if (ly_dir_p (force_dir) && to_dir (force_dir)) p->set_grob_property ("direction", force_dir); diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index a448d15ef8..723e111741 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -105,8 +105,8 @@ Text_engraver::process_acknowledged_grobs () if (gh_number_p (s)) priority = gh_scm2int (s); - /* Make sure they're in order of user input by adding index i. */ - priority += i * (r->get_direction () ? r->get_direction () : 1); + /* see script-engraver.cc */ + priority += i; text->set_grob_property ("script-priority", gh_int2scm (priority)); diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index e8c871ec36..6428188e1f 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -509,8 +509,10 @@ def run_lilypond (files, dep_prefix): + _ ("Please submit a bug report to bug-lilypond@gnu.org") + "\n") if status: - error ( "\n" \ - + _ ("LilyPond failed on the input file (exit status %d).") % exit_status + "\n") + sys.stderr.write ( "\n" \ + + _ ("LilyPond failed on an input file (exit status %d).") % exit_status + "\n") + sys.stderr.write (_("Trying to salvage the rest.") +'\n\n') + def analyse_lilypond_output (filename, extra):