From f02831f92e71ce43e3b67e06c0d46dc19ad9bde3 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sat, 4 Feb 2017 13:43:41 +0100 Subject: [PATCH] Issue 5052: Information preserving parts of issue 4342 Those should not affect any output. --- lily/accidental-engraver.cc | 2 +- lily/book-scheme.cc | 2 +- lily/break-alignment-interface.cc | 5 +++-- lily/grob-pq-engraver.cc | 2 +- lily/key-engraver.cc | 3 ++- lily/music.cc | 2 +- lily/ottava-engraver.cc | 2 +- lily/page-breaking.cc | 4 ++-- lily/page-layout-problem.cc | 2 +- lily/paper-book.cc | 2 +- lily/paper-column.cc | 3 ++- lily/parser.yy | 4 ++-- lily/prob-scheme.cc | 2 +- lily/script-column.cc | 8 ++++---- lily/simple-spacer.cc | 2 +- lily/spring-smob.cc | 3 ++- lily/stanza-number-engraver.cc | 2 +- lily/time-signature-engraver.cc | 3 +-- 18 files changed, 28 insertions(+), 25 deletions(-) diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index d8cc647bc0..003b37ff31 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -508,7 +508,7 @@ void Accidental_engraver::process_music () { SCM sig = get_property ("keyAlterations"); - if (last_keysig_ != sig) + if (!scm_is_eq (last_keysig_, sig)) update_local_key_signature (sig); } diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc index af0cb62632..c63f47dd07 100644 --- a/lily/book-scheme.cc +++ b/lily/book-scheme.cc @@ -152,7 +152,7 @@ LY_DEFINE (ly_book_header, "ly:book-header", { LY_ASSERT_SMOB (Book, book, 1); Book *b = unsmob (book); - return b->header_ ? b->header_ : SCM_BOOL_F; + return ly_is_module (b->header_) ? b->header_ : SCM_BOOL_F; } LY_DEFINE (ly_book_set_header_x, "ly:book-set-header!", diff --git a/lily/break-alignment-interface.cc b/lily/break-alignment-interface.cc index e2a546f6a6..a1d7606445 100644 --- a/lily/break-alignment-interface.cc +++ b/lily/break-alignment-interface.cc @@ -73,7 +73,7 @@ Break_alignment_interface::ordered_elements (Grob *grob) for (vsize i = writable_elts.size (); i--;) { Grob *g = writable_elts[i]; - if (g && sym == g->get_property ("break-align-symbol")) + if (g && scm_is_eq (sym, g->get_property ("break-align-symbol"))) { new_elts.push_back (g); writable_elts.erase (writable_elts.begin () + i); @@ -277,9 +277,10 @@ Break_alignable_interface::self_align_callback (SCM grob) SCM sym = scm_car (symbol_list); for (vsize i = 0; i < elements.size (); i++) { - if (elements[i]->get_property ("break-align-symbol") == sym) + if (scm_is_eq (sym, elements[i]->get_property ("break-align-symbol"))) { if (Item::break_visible (elements[i]) + // TODO SCM: simplify syntax? && !elements[i]->extent (elements[i], X_AXIS).is_empty ()) { break_aligned_grob = i; diff --git a/lily/grob-pq-engraver.cc b/lily/grob-pq-engraver.cc index 174b93c26a..a9fa75eda5 100644 --- a/lily/grob-pq-engraver.cc +++ b/lily/grob-pq-engraver.cc @@ -145,7 +145,7 @@ Grob_pq_engraver::start_translation_timestep () busy = scm_cdr (busy); } - if (start_busy != busy) + if (!scm_is_eq (start_busy, busy)) context ()->set_property ("busyGrobs", busy); } diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index f54421cf25..a61d7701d7 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -148,7 +148,8 @@ void Key_engraver::process_music () { if (key_event_ - || get_property ("lastKeyAlterations") != get_property ("keyAlterations")) + || !scm_is_eq (get_property ("lastKeyAlterations"), + get_property ("keyAlterations"))) create_key (false); } diff --git a/lily/music.cc b/lily/music.cc index 8b9da5596d..ae75ff7952 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -237,7 +237,7 @@ Prob::transpose (Pitch delta) && scm_is_pair (val)) new_val = ly_transpose_key_alist (val, delta.smobbed_copy ()); - if (val != new_val) + if (!scm_is_eq (val, new_val)) scm_set_cdr_x (entry, new_val); } } diff --git a/lily/ottava-engraver.cc b/lily/ottava-engraver.cc index 9a846377fb..e9bcbe94d5 100644 --- a/lily/ottava-engraver.cc +++ b/lily/ottava-engraver.cc @@ -64,7 +64,7 @@ void Ottava_spanner_engraver::process_music () { SCM ott = get_property ("ottavation"); - if (ott != last_ottavation_) + if (!scm_is_eq (ott, last_ottavation_)) { finished_ = span_; span_ = 0; diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc index ef9e095d6a..fb47684898 100644 --- a/lily/page-breaking.cc +++ b/lily/page-breaking.cc @@ -651,7 +651,7 @@ Page_breaking::make_pages (vector lines_per_page, SCM systems) SCM lines = scm_caar (s); SCM config = scm_cdar (s); - bool bookpart_last_page = (s == systems_configs_fncounts); + bool bookpart_last_page = scm_is_eq (s, systems_configs_fncounts); SCM page = draw_page (lines, config, page_num, bookpart_last_page); /* collect labels */ SCM page_num_scm = scm_from_int (page_num); @@ -760,7 +760,7 @@ Page_breaking::find_chunks_and_breaks (Break_predicate is_break, Prob_break_pred bool last = (j == cols.size () - 1); bool break_point = is_break && is_break (cols[j]); - bool chunk_end = cols[j]->get_property ("page-break-permission") == force_sym; + bool chunk_end = scm_is_eq (cols[j]->get_property ("page-break-permission"), force_sym); Break_position cur_pos = Break_position (i, line_breaker_columns.size (), cols[j], diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc index 8f1951223c..479ac72bf7 100644 --- a/lily/page-layout-problem.cc +++ b/lily/page-layout-problem.cc @@ -449,7 +449,7 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst for (SCM s = systems; scm_is_pair (s); s = scm_cdr (s)) { - bool first = (s == systems); + bool first = scm_is_eq (s, systems); if (Grob *g = unsmob (scm_car (s))) { diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 3a672198b5..c17ed576f1 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -514,7 +514,7 @@ Paper_book::get_system_specs () SCM footnotes = get_footnotes (unsmob (t)->expr ()); ps->set_property ("footnotes", footnotes); ps->set_property ("is-title", SCM_BOOL_T); - if (list == texts) + if (scm_is_eq (list, texts)) first = ps; else { diff --git a/lily/paper-column.cc b/lily/paper-column.cc index da3807c31d..5462027928 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -209,7 +209,8 @@ Paper_column::break_align_width (Grob *me, SCM align_syms) extract_grob_set (me, "elements", elts); for (vsize i = 0; i < elts.size (); i++) { - if (elts[i]->get_property ("break-align-symbol") == align_sym + if (scm_is_eq (align_sym, elts[i]->get_property ("break-align-symbol")) + // TODO SCM: there must be a simpler way to put this. && !elts[i]->extent (elts[i], X_AXIS).is_empty ()) { align = elts[i]; diff --git a/lily/parser.yy b/lily/parser.yy index 065713de1a..35d858c46f 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2719,8 +2719,8 @@ context_mod: | context_def_mod embedded_scm { if (!scm_is_string ($2) - && ly_symbol2scm ("consists") != $1 - && ly_symbol2scm ("remove") != $1) + && !scm_is_eq ($1, ly_symbol2scm ("consists")) + && !scm_is_eq ($1, ly_symbol2scm ("remove"))) { $$ = SCM_EOL; parser->parser_error (@1, _ ("only \\consists and \\remove take non-string argument.")); diff --git a/lily/prob-scheme.cc b/lily/prob-scheme.cc index 03c84eca4d..a9424da91f 100644 --- a/lily/prob-scheme.cc +++ b/lily/prob-scheme.cc @@ -67,7 +67,7 @@ LY_DEFINE (ly_prob_type_p, "ly:prob-type?", "Is @var{obj} the specified prob-type?") { Prob *prob = unsmob (obj); - return scm_from_bool (prob && prob->type () == type); + return scm_from_bool (prob && scm_is_eq (prob->type (), type)); } LY_DEFINE (ly_make_prob, "ly:make-prob", diff --git a/lily/script-column.cc b/lily/script-column.cc index 94aa8908e7..a12560bf8e 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -77,8 +77,8 @@ Script_column::row_before_line_breaking (SCM smob) { affect_all_grobs.push_back (sc); } - else if (sc->get_property_data ("Y-offset") - != Side_position_interface::y_aligned_side_proc) + else if (!scm_is_eq (sc->get_property_data ("Y-offset"), + Side_position_interface::y_aligned_side_proc)) { head_scripts_map[sc->get_parent (Y_AXIS)].push_back (sc); } @@ -112,8 +112,8 @@ Script_column::before_line_breaking (SCM smob) /* Don't want to consider scripts horizontally next to notes. */ - if (sc->get_property_data ("X-offset") - != Side_position_interface::x_aligned_side_proc) + if (!scm_is_eq (sc->get_property_data ("X-offset"), + Side_position_interface::x_aligned_side_proc)) staff_sided.push_back (sc); } diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index bf64413a8a..cf4fd5849e 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -470,7 +470,7 @@ get_line_forces (vector const &columns, force[b * breaks.size () + c] = infinity_f; break; } - if (end < cols.size () && cols[end].break_permission_ == force_break) + if (end < cols.size () && scm_is_eq (cols[end].break_permission_, force_break)) break; } } diff --git a/lily/spring-smob.cc b/lily/spring-smob.cc index a389df2efd..19a5eef4c5 100644 --- a/lily/spring-smob.cc +++ b/lily/spring-smob.cc @@ -26,7 +26,8 @@ SCM Spring::equal_p (SCM a, SCM b) { - return a == b ? SCM_BOOL_T : SCM_BOOL_F; + // TODO SCM: This could be made simpler. + return scm_is_eq (a, b) ? SCM_BOOL_T : SCM_BOOL_F; } LY_DEFINE (ly_make_spring, "ly:make-spring", diff --git a/lily/stanza-number-engraver.cc b/lily/stanza-number-engraver.cc index f823e09919..4b7eaa5a8a 100644 --- a/lily/stanza-number-engraver.cc +++ b/lily/stanza-number-engraver.cc @@ -60,7 +60,7 @@ Stanza_number_engraver::process_music () SCM stanza = get_property ("stanza"); if (Text_interface::is_markup (stanza) - && stanza != last_stanza_) + && !scm_is_eq (stanza, last_stanza_)) { last_stanza_ = stanza; diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index 1f7a8d6fe3..e4e76e17d6 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -74,8 +74,7 @@ Time_signature_engraver::process_music () return; SCM fr = get_property ("timeSignatureFraction"); - if (last_time_fraction_ != fr - && scm_is_pair (fr)) + if (!scm_is_eq (last_time_fraction_, fr) && scm_is_pair (fr)) { time_signature_ = make_item ("TimeSignature", time_cause_); time_signature_->set_property ("fraction", fr); -- 2.39.2