From 459d4d5eaa90373349eb0461af7b6e3cdfd56981 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 27 May 2006 12:34:22 +0000 Subject: [PATCH] (get_paper_systems): uniq all_elements_ , to prevent duplicated broken items in output. --- ChangeLog | 3 +++ lily/grob-array.cc | 7 +++++++ lily/include/grob-array.hh | 1 + lily/lily-guile.cc | 4 +++- lily/system.cc | 35 +++++++++++++++++------------------ 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index e79f324ba0..bebddfec67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-05-27 Han-Wen Nienhuys + * lily/system.cc (get_paper_systems): uniq all_elements_ , to + prevent duplicated broken items in output. + * scm/framework-eps.scm (output-classic-framework): only dump if dump-signatures is set. diff --git a/lily/grob-array.cc b/lily/grob-array.cc index 7b462cbba2..f9982f1514 100644 --- a/lily/grob-array.cc +++ b/lily/grob-array.cc @@ -82,6 +82,12 @@ Grob_array::clear () grobs_.clear (); } +void +Grob_array::uniq () +{ + ::uniq (grobs_); +} + bool Grob_array::empty () const { @@ -108,3 +114,4 @@ grob_list_to_grob_array (SCM lst) ga->add (unsmob_grob (scm_car (s))); return arr_scm; } + diff --git a/lily/include/grob-array.hh b/lily/include/grob-array.hh index 47580b38d1..f80c83632d 100644 --- a/lily/include/grob-array.hh +++ b/lily/include/grob-array.hh @@ -29,6 +29,7 @@ public: Grob *grob (vsize i) { return grobs_.at (i); } vsize size () const { return grobs_.size (); } bool empty () const; + void uniq (); void clear (); void add (Grob *x) { grobs_.push_back (x); } void set_array (vector const &src); diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 065ea388ee..e44e47f4be 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -498,7 +498,9 @@ scm_default_compare (void const *a, void const *b) return pa < pb ? -1 : 1; } -/* Modify LST in place: qsort it. */ +/* Modify LST in place: qsort it. + +FIXME: unused, junk? */ SCM ly_list_qsort_uniq_x (SCM lst) { diff --git a/lily/system.cc b/lily/system.cc index 7e78eb2a11..d1581b9e06 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -163,27 +163,22 @@ System::get_paper_systems () handle_broken_dependencies (); -#if 0 /* FIXME: strange side effects. */ - /* Because the this->get_property (all-elements) contains items in 3 versions, handle_broken_dependencies () will leave duplicated items in all-elements. Strictly speaking this is harmless, but - it leads to duplicated symbols in the output. ly_list_qsort_uniq_x () - makes sure that no duplicates are in the list. */ - for (int i = 0; i < line_count; i++) + it leads to duplicated symbols in the output. uniq makes sure + that no duplicates are in the list. */ + for (vsize i = 0; i < broken_intos_.size (); i++) { - SCM all = broken_intos_[i]->get_object ("all-elements"); - all = ly_list_qsort_uniq_x (all); + System *child = dynamic_cast (broken_intos_[i]); + child->all_elements_->uniq (); } -#endif if (be_verbose_global) message (_f ("Element count %d.", count + element_count ())); - int line_count = broken_intos_.size (); - SCM lines = scm_c_make_vector (line_count, SCM_EOL); - - for (int i = 0; i < line_count; i++) + SCM lines = scm_c_make_vector (broken_intos_.size (), SCM_EOL); + for (vsize i = 0; i < broken_intos_.size (); i++) { if (be_verbose_global) progress_indication ("["); @@ -333,16 +328,20 @@ System::get_paper_system () SCM exprs = SCM_EOL; SCM *tail = &exprs; - /* Output stencils in three layers: 0, 1, 2. Default layer: 1. */ + /* Output stencils in three layers: 0, 1, 2. Default layer: 1. + + FIXME: softcode this. + */ for (int i = 0; i < LAYER_COUNT; i++) - for (vsize j = all_elements_->size (); j--;) + for (vsize j = 0; j < all_elements_->size (); j++) { Grob *g = all_elements_->grob (j); + if (robust_scm2int (g->get_property ("layer"), 1) != i) + continue; + Stencil st = g->get_print_stencil (); - /* Skip empty stencils and grobs that are not in this layer. */ - if (st.expr() == SCM_EOL - || robust_scm2int (g->get_property ("layer"), 1) != i) + if (st.expr() == SCM_EOL) continue; Offset o; @@ -390,7 +389,7 @@ System::get_paper_system () Interval staff_refpoints; staff_refpoints.set_empty (); extract_grob_set (this, "spaceable-staves", staves); - for (vsize i = staves.size (); i--;) + for (vsize i = 0; i < staves.size (); i++) { Grob *g = staves[i]; staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS)); -- 2.39.2