diff options
author | Valentin Villenave <valentin@villenave.net> | 2015-04-21 17:57:03 +0200 |
---|---|---|
committer | Valentin Villenave <valentin@villenave.net> | 2015-04-21 17:57:03 +0200 |
commit | e0af94bb8939bc6f4998db6294010baa77139092 (patch) | |
tree | a70e48317413af4ce8026b444ceab8ff9c579657 | |
parent | 237343567335e54017c40545dc2e20fb3eca50fa (diff) |
Replace C++ (in)equality checks with proper SCM syntax
This commit replaces the most straightforward situations
where two SCM objects are compared. Here are the basic
replacements used:
x == y -------> scm_is_eq (x,y)
x == SCM_BOOL_T -------> to_boolean (x)
x == SCM_BOOL_F -------> scm_is_false (x)
x != SCM_BOOL_T -------> scm_is_true (x)
x == SCM_UNDEFINED -------> SCM_UNBNDP (x)
x == SCM_EOL -------> scm_is_null (x)
(scm_exact_p (x) == SCM_BOOL_T) -------> ly_is_rational (x)
(scm_integer_p (x) == SCM_BOOL_T) -------> scm_is_integer (x)
(scm_list_p (x) == SCM_BOOL_T) -------> ly_is_list (x)
(scm_port_p (x) == SCM_BOOL_T) -------> ly_is_port (x)
(scm_equal_p (x, y) == SCM_BOOL_T) -------> ly_is_equal (x,y)
Finally, I replaced (!cached) with (!SCM_UNPACK (cached)) in
lily-guile-macros.hh, as has been suggested once by David.
Please note that this commit does not handle some situations
I’m less comfortable with (namely those involving scm_c_memq,
scm_assq or scm_hashq_get_handle), and some scm_*_p checks
for which there isn’t a ly_is_* replacement yet (to wit,
scm_hash_table_p, scm_promise_p, and scm_variable_bound_p).
Those should be dealt with later (another patch is in the works).
140 files changed, 526 insertions, 508 deletions
diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index fcc9fcb977..4bdf597357 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -317,7 +317,7 @@ Accidental_engraver::make_standard_accidental (Stream_event * /* note */, */ for (vsize i = 0; i < left_objects_.size (); i++) { - if (left_objects_[i]->get_property ("side-axis") == scm_from_int (X_AXIS)) + if (scm_is_eq (left_objects_[i]->get_property ("side-axis"), scm_from_int (X_AXIS))) Side_position_interface::add_support (left_objects_[i], a); } @@ -332,7 +332,7 @@ Accidental_engraver::make_standard_accidental (Stream_event * /* note */, Accidental_placement::add_accidental (accidental_placement_, a, - get_property ("accidentalGrouping") == ly_symbol2scm ("voice"), + scm_is_eq (get_property ("accidentalGrouping"), ly_symbol2scm ("voice")), (long) trans); note_head->set_object ("accidental-grob", a->self_scm ()); @@ -467,7 +467,8 @@ Accidental_engraver::acknowledge_rhythmic_head (Grob_info info) || note->in_event_class ("trill-span-event")) // option to skip accidentals on string harmonics && (to_boolean (get_property ("harmonicAccidentals")) - || info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic")) + || !scm_is_eq (info.grob ()->get_property ("style"), + ly_symbol2scm ("harmonic"))) // ignore accidentals in non-printing voices like NullVoice && !to_boolean (info.context ()->get_property ("nullAccidentals"))) { diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index c8c14d4bd9..04883f03a9 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -61,7 +61,7 @@ Accidental_placement::add_accidental (Grob *me, Grob *a, bool stagger, long cont SCM key = scm_cons (scm_from_int (n), scm_from_long (stagger ? context_hash : 1)); // assoc because we're dealing with pairs SCM entry = scm_assoc (key, accs); - if (entry == SCM_BOOL_F) + if (scm_is_false (entry)) entry = SCM_EOL; else entry = scm_cdr (entry); @@ -342,7 +342,7 @@ extract_heads_and_stems (vector<Accidental_placement_entry *> const &apes) for (vsize i = ret.size (); i--;) if (Grob *s = Rhythmic_head::get_stem (ret[i])) ret.push_back (s); - + uniquify (ret); return ret; } diff --git a/lily/align-interface.cc b/lily/align-interface.cc index d187326922..fffc64b1bb 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -179,7 +179,7 @@ Align_interface::internal_get_minimum_translations (Grob *me, SCM fv = ly_assoc_get (scm_cons (scm_from_int (start), scm_from_int (end)), me->get_property ("minimum-translations-alist"), SCM_EOL); - if (fv != SCM_EOL) + if (!scm_is_null (fv)) return ly_scm2floatvector (fv); } diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index 58716c3ccf..fedf31e5d4 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -174,11 +174,11 @@ Ambitus_engraver::finalize () scm_from_int (p.get_notename ())), start_key_sig_); - if (handle == SCM_BOOL_F) + if (scm_is_false (handle)) handle = scm_assoc (scm_from_int (p.get_notename ()), start_key_sig_); - Rational sig_alter = (handle != SCM_BOOL_F) + Rational sig_alter = (scm_is_true (handle)) ? robust_scm2rational (scm_cdr (handle), Rational (0)) : Rational (0); diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index bdf5b8f491..beb8fce390 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -170,12 +170,11 @@ Auto_beam_engraver::listen_beam_forbid (Stream_event *ev) bool Auto_beam_engraver::test_moment (Direction dir, Moment test_mom, Moment dur) { - return scm_call_4 (get_property ("autoBeamCheck"), - context ()->self_scm (), - scm_from_int (dir), - test_mom.smobbed_copy (), - dur.smobbed_copy ()) - != SCM_BOOL_F; + return scm_is_true (scm_call_4 (get_property ("autoBeamCheck"), + context ()->self_scm (), + scm_from_int (dir), + test_mom.smobbed_copy (), + dur.smobbed_copy ())); } void @@ -438,7 +437,7 @@ Auto_beam_engraver::acknowledge_stem (Grob_info info) durlog - 2, Stem::is_invisible (stem), stem_duration->factor (), - (stem->get_property ("tuplet-start") == SCM_BOOL_T)); + (to_boolean (stem->get_property ("tuplet-start")))); stems_->push_back (stem); last_add_mom_ = now; extend_mom_ = max (extend_mom_, now) + get_event_length (ev, now); diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 946db34a8b..4056e25651 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -705,10 +705,10 @@ valid_outside_staff_placement_directive (Grob *me) { SCM directive = me->get_property ("outside-staff-placement-directive"); - if ((directive == ly_symbol2scm ("left-to-right-greedy")) - || (directive == ly_symbol2scm ("left-to-right-polite")) - || (directive == ly_symbol2scm ("right-to-left-greedy")) - || (directive == ly_symbol2scm ("right-to-left-polite"))) + if (scm_is_eq (directive, ly_symbol2scm ("left-to-right-greedy")) + || scm_is_eq (directive, ly_symbol2scm ("left-to-right-polite")) + || scm_is_eq (directive, ly_symbol2scm ("right-to-left-greedy")) + || scm_is_eq (directive, ly_symbol2scm ("right-to-left-polite"))) return directive; me->warning (_f ("\"%s\" is not a valid outside-staff-placement-directive", @@ -735,11 +735,11 @@ add_grobs_of_one_priority (Grob *me, SCM directive = valid_outside_staff_placement_directive (me); - bool l2r = ((directive == ly_symbol2scm ("left-to-right-greedy")) - || (directive == ly_symbol2scm ("left-to-right-polite"))); + bool l2r = (scm_is_eq (directive, ly_symbol2scm ("left-to-right-greedy")) + || scm_is_eq (directive, ly_symbol2scm ("left-to-right-polite"))); - bool polite = ((directive == ly_symbol2scm ("left-to-right-polite")) - || (directive == ly_symbol2scm ("right-to-left-polite"))); + bool polite = (scm_is_eq (directive, ly_symbol2scm ("left-to-right-polite")) + || scm_is_eq (directive, ly_symbol2scm ("right-to-left-polite"))); vector<Box> boxes; vector<Skyline_pair> skylines_to_merge; diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index b210ab7680..397743b4b0 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -59,7 +59,7 @@ Bar_engraver::create_bar () { bar_ = make_item ("BarLine", SCM_EOL); SCM gl = get_property ("whichBar"); - if (scm_equal_p (gl, bar_->get_property ("glyph")) != SCM_BOOL_T) + if (!ly_is_equal (gl, bar_->get_property ("glyph"))) bar_->set_property ("glyph", gl); } } diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index eb4af48054..144076439c 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -62,8 +62,10 @@ Bar_number_engraver::listen_alternative (Stream_event *ev) alternative_event_ = ev; int current_barnumber = robust_scm2int (get_property ("currentBarNumber"), 0); Direction alternative_dir = robust_scm2dir (ev->get_property ("alternative-dir"), CENTER); - bool make_alternative = get_property ("alternativeNumberingStyle") == ly_symbol2scm ("numbers") - || get_property ("alternativeNumberingStyle") == ly_symbol2scm ("numbers-with-letters"); + bool make_alternative = scm_is_eq (get_property ("alternativeNumberingStyle"), + ly_symbol2scm ("numbers")) + || scm_is_eq (get_property ("alternativeNumberingStyle"), + ly_symbol2scm ("numbers-with-letters")); if (make_alternative) { /* @@ -100,7 +102,7 @@ Bar_number_engraver::process_music () create_items (); SCM alternative_style = get_property ("alternativeNumberingStyle"); string text_tag = ""; - if (alternative_style == ly_symbol2scm ("numbers-with-letters")) + if (scm_is_eq (alternative_style, ly_symbol2scm ("numbers-with-letters"))) { if (alternative_event_) { diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 4e4f991cb3..f19f7e604e 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -308,7 +308,7 @@ Beam_engraver::acknowledge_stem (Grob_info info) max (durlog - 2, 0), Stem::is_invisible (stem), stem_duration->factor (), - (stem->get_property ("tuplet-start") == SCM_BOOL_T)); + (to_boolean (stem->get_property ("tuplet-start")))); Beam::add_stem (beam_, stem); } diff --git a/lily/beam.cc b/lily/beam.cc index 83b0c743f9..82cbb1e766 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -203,7 +203,8 @@ Beam::calc_direction (SCM smob) placing this here avoids warnings downstream */ if (heads.size()) { - if (heads[0]->get_property ("style") == ly_symbol2scm ("kievan")) + if (scm_is_eq (heads[0]->get_property ("style"), + ly_symbol2scm ("kievan"))) { if (dir == CENTER) dir = DOWN; @@ -256,7 +257,7 @@ position_with_maximal_common_beams (SCM left_beaming, SCM right_beaming, for (SCM s = scm_car (right_beaming); scm_is_pair (s); s = scm_cdr (s)) { int k = -right_dir * scm_to_int (scm_car (s)) + i; - if (scm_c_memq (scm_from_int (k), left_beaming) != SCM_BOOL_F) + if (scm_is_true (scm_c_memq (scm_from_int (k), left_beaming))) count++; } @@ -961,7 +962,7 @@ Beam::calc_stem_shorten (SCM smob) int beam_count = get_beam_count (me); SCM shorten_list = me->get_property ("beamed-stem-shorten"); - if (shorten_list == SCM_EOL) + if (scm_is_null (shorten_list)) return scm_from_int (0); Real staff_space = Staff_symbol_referencer::staff_space (me); @@ -1003,7 +1004,7 @@ where_are_the_whole_beams (SCM beaming) for (SCM s = scm_car (beaming); scm_is_pair (s); s = scm_cdr (s)) { - if (scm_c_memq (scm_car (s), scm_cdr (beaming)) != SCM_BOOL_F) + if (scm_is_true (scm_c_memq (scm_car (s), scm_cdr (beaming)))) l.add_point (scm_to_int (scm_car (s))); } @@ -1139,8 +1140,8 @@ Beam::set_beaming (Grob *me, Beaming_pattern const *beaming) { Grob *stem = stems[i]; SCM beaming_prop = stem->get_property ("beaming"); - if (beaming_prop == SCM_EOL - || index_get_cell (beaming_prop, d) == SCM_EOL) + if (scm_is_null (beaming_prop) + || scm_is_null (index_get_cell (beaming_prop, d))) { int count = beaming->beamlet_count (i, d); if (i > 0 diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index 6da5ba603e..fe07cac0c8 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -136,7 +136,7 @@ Break_align_engraver::add_to_group (SCM align_name, Item *item) SCM s = scm_assoc (align_name, column_alist_); Item *group = 0; - if (s != SCM_BOOL_F) + if (scm_is_true (s)) { Grob *e = Grob::unsmob (scm_cdr (s)); group = dynamic_cast<Item *> (e); diff --git a/lily/break-alignment-interface.cc b/lily/break-alignment-interface.cc index db0a74f59a..bb7f02eda0 100644 --- a/lily/break-alignment-interface.cc +++ b/lily/break-alignment-interface.cc @@ -58,7 +58,7 @@ Break_alignment_interface::ordered_elements (Grob *grob) SCM order = break_align_order (me); - if (order == SCM_BOOL_F) + if (scm_is_false (order)) return elts; vector<Grob *> writable_elts (elts); @@ -144,8 +144,8 @@ Break_alignment_interface::calc_positioning_done (SCM smob) Grob *elt = elts[i]; if (edge_idx == VPOS - && (elt->get_property ("break-align-symbol") - == ly_symbol2scm ("left-edge"))) + && scm_is_eq (elt->get_property ("break-align-symbol"), + ly_symbol2scm ("left-edge"))) edge_idx = idx; SCM l = elt->get_property ("space-alist"); @@ -174,7 +174,7 @@ Break_alignment_interface::calc_positioning_done (SCM smob) } } - if (rsym == ly_symbol2scm ("left-edge")) + if (scm_is_eq (rsym, ly_symbol2scm ("left-edge"))) edge_idx = next_idx; SCM entry = SCM_EOL; @@ -210,11 +210,11 @@ Break_alignment_interface::calc_positioning_done (SCM smob) if (r) { - if (type == ly_symbol2scm ("extra-space")) + if (scm_is_eq (type, ly_symbol2scm ("extra-space"))) offsets[next_idx] = extents[idx][RIGHT] + distance - extents[next_idx][LEFT]; /* should probably junk minimum-space */ - else if (type == ly_symbol2scm ("minimum-space")) + else if (scm_is_eq (type, ly_symbol2scm ("minimum-space"))) offsets[next_idx] = max (extents[idx][RIGHT], distance); } else diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc index c2a363cb73..2028226447 100644 --- a/lily/break-substitution.cc +++ b/lily/break-substitution.cc @@ -125,8 +125,8 @@ again: SCM newcar = do_break_substitution (scm_car (src)); SCM oldcdr = scm_cdr (src); - if (newcar == SCM_UNDEFINED - && (scm_is_pair (oldcdr) || oldcdr == SCM_EOL)) + if (SCM_UNBNDP (newcar) + && (scm_is_pair (oldcdr) || scm_is_null (oldcdr))) { /* This is tail-recursion, ie. @@ -477,7 +477,7 @@ substitute_object_alist (SCM alist, SCM dest) else val = do_break_substitution (val); - if (val != SCM_UNDEFINED) + if (!SCM_UNBNDP (val)) { /* for ly:grob? properties, SCM_UNDEFINED could leak out diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 539efcdf4c..10420273ab 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -99,7 +99,7 @@ Chord_name_engraver::process_music () if (!Pitch::is_smob (p)) continue; - if (n->get_property ("bass") == SCM_BOOL_T) + if (to_boolean (n->get_property ("bass"))) bass = p; else { @@ -111,7 +111,7 @@ Chord_name_engraver::process_music () } else pitches = scm_cons (p, pitches); - if (n->get_property ("inversion") == SCM_BOOL_T) + if (to_boolean (n->get_property ("inversion"))) { inversion = p; if (!scm_is_number (oct)) diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index b6efa00c76..ebeb71a7cb 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -156,17 +156,17 @@ Clef_engraver::inspect_clef_properties () SCM transposition = get_property ("clefTransposition"); SCM force_clef = get_property ("forceClef"); - if (clefpos == SCM_EOL - || scm_equal_p (glyph, prev_glyph_) == SCM_BOOL_F - || scm_equal_p (clefpos, prev_cpos_) == SCM_BOOL_F - || scm_equal_p (transposition, prev_transposition_) == SCM_BOOL_F + if (scm_is_null (clefpos) + || !ly_is_equal (glyph, prev_glyph_) + || !ly_is_equal (clefpos, prev_cpos_) + || !ly_is_equal (transposition, prev_transposition_) || to_boolean (force_clef)) { apply_on_children (context (), ly_lily_module_constant ("invalidate-alterations")); set_glyph (); - if (prev_cpos_ != SCM_BOOL_F || to_boolean (get_property ("firstClef"))) + if (scm_is_true (prev_cpos_) || to_boolean (get_property ("firstClef"))) create_clef (); if (clef_) diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index e2d7081497..1a98775a96 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -365,10 +365,10 @@ Constrained_breaking::Constrained_breaking (Paper_score *ps, vector<vsize> const static SCM min_permission (SCM perm1, SCM perm2) { - if (perm1 == ly_symbol2scm ("force")) + if (scm_is_eq (perm1, ly_symbol2scm ("force"))) return perm2; - if (perm1 == ly_symbol2scm ("allow") - && perm2 != ly_symbol2scm ("force")) + if (scm_is_eq (perm1, ly_symbol2scm ("allow")) + && !scm_is_eq (perm2, ly_symbol2scm ("force"))) return perm2; return SCM_EOL; } diff --git a/lily/context-def.cc b/lily/context-def.cc index 534567de2c..10f31ae830 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -117,7 +117,7 @@ void Context_def::add_context_mod (SCM mod) { SCM tag = scm_car (mod); - if (ly_symbol2scm ("description") == tag) + if (scm_is_eq (tag, ly_symbol2scm ("description"))) { description_ = scm_cadr (mod); return; @@ -130,27 +130,27 @@ Context_def::add_context_mod (SCM mod) if (scm_is_string (sym)) sym = scm_string_to_symbol (sym); - if (ly_symbol2scm ("default-child") == tag) + if (scm_is_eq (tag, ly_symbol2scm ("default-child"))) default_child_ = sym; - else if (ly_symbol2scm ("consists") == tag - || ly_symbol2scm ("remove") == tag) + else if (scm_is_eq (tag, ly_symbol2scm ("consists")) + || scm_is_eq (tag, ly_symbol2scm ("remove"))) { translator_mods_ = scm_cons (scm_list_2 (tag, sym), translator_mods_); } - else if (ly_symbol2scm ("accepts") == tag - || ly_symbol2scm ("denies") == tag) + else if (scm_is_eq (tag, ly_symbol2scm ("accepts")) + || scm_is_eq (tag, ly_symbol2scm ("denies"))) accept_mods_ = scm_cons (scm_list_2 (tag, sym), accept_mods_); - else if (ly_symbol2scm ("pop") == tag - || ly_symbol2scm ("push") == tag - || ly_symbol2scm ("assign") == tag - || ly_symbol2scm ("unset") == tag - || ly_symbol2scm ("apply") == tag) + else if (scm_is_eq (tag, ly_symbol2scm ("pop")) + || scm_is_eq (tag, ly_symbol2scm ("push")) + || scm_is_eq (tag, ly_symbol2scm ("assign")) + || scm_is_eq (tag, ly_symbol2scm ("unset")) + || scm_is_eq (tag, ly_symbol2scm ("apply"))) property_ops_ = scm_cons (mod, property_ops_); - else if (ly_symbol2scm ("alias") == tag) + else if (scm_is_eq (tag, ly_symbol2scm ("alias"))) context_aliases_ = scm_cons (sym, context_aliases_); - else if (ly_symbol2scm ("translator-type") == tag) + else if (scm_is_eq (tag, ly_symbol2scm ("translator-type"))) translator_group_type_ = sym; - else if (ly_symbol2scm ("context-name") == tag) + else if (scm_is_eq (tag, ly_symbol2scm ("context-name"))) context_name_ = sym; else programming_error ("unknown context mod tag"); @@ -165,9 +165,9 @@ Context_def::get_accepted (SCM user_mod) const { SCM tag = scm_caar (s); SCM sym = scm_cadar (s); - if (tag == ly_symbol2scm ("accepts")) + if (scm_is_eq (tag, ly_symbol2scm ("accepts"))) acc = scm_cons (sym, acc); - else if (tag == ly_symbol2scm ("denies")) + else if (scm_is_eq (tag, ly_symbol2scm ("denies"))) acc = scm_delete_x (sym, acc); } @@ -188,7 +188,7 @@ Context_def::get_default_child (SCM user_mod) const for (SCM s = user_mod; scm_is_pair (s); s = scm_cdr (s)) { SCM entry = scm_car (s); - if (scm_car (entry) == ly_symbol2scm ("default-child")) + if (scm_is_eq (scm_car (entry), ly_symbol2scm ("default-child"))) { name = scm_cadr (entry); break; @@ -289,9 +289,9 @@ Context_def::get_translator_names (SCM user_mod) const if (scm_is_string (arg)) arg = scm_string_to_symbol (arg); - if (ly_symbol2scm ("consists") == tag) + if (scm_is_eq (tag, ly_symbol2scm ("consists"))) l1 = scm_cons (arg, l1); - else if (ly_symbol2scm ("remove") == tag + else if (scm_is_eq (tag, ly_symbol2scm ("remove")) && (scm_is_pair (arg) || ly_is_procedure (arg) || get_translator (arg))) diff --git a/lily/context-mod-scheme.cc b/lily/context-mod-scheme.cc index 4d6fef5c09..493e151c1d 100644 --- a/lily/context-mod-scheme.cc +++ b/lily/context-mod-scheme.cc @@ -47,7 +47,7 @@ LY_DEFINE (ly_make_context_mod, "ly:make-context-mod", "Creates a context modification, optionally initialized" " via the list of modifications @var{mod-list}.") { - if (mod_list != SCM_UNDEFINED) + if (!SCM_UNBNDP (mod_list)) { LY_ASSERT_TYPE (ly_cheap_is_list, mod_list, 1); return Context_mod (mod_list).smobbed_copy (); diff --git a/lily/context-property.cc b/lily/context-property.cc index 62e04a2732..59bcf9afc6 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -321,24 +321,24 @@ apply_property_operations (Context *tg, SCM pre_init_ops) SCM type = scm_car (entry); entry = scm_cdr (entry); - if (type == ly_symbol2scm ("push")) + if (scm_is_eq (type, ly_symbol2scm ("push"))) { SCM context_prop = scm_car (entry); SCM val = scm_cadr (entry); SCM grob_prop_path = scm_cddr (entry); Grob_property_info (tg, context_prop).push (grob_prop_path, val); } - else if (type == ly_symbol2scm ("pop")) + else if (scm_is_eq (type, ly_symbol2scm ("pop"))) { SCM context_prop = scm_car (entry); SCM grob_prop_path = scm_cdr (entry); Grob_property_info (tg, context_prop).pop (grob_prop_path); } - else if (type == ly_symbol2scm ("assign")) + else if (scm_is_eq (type, ly_symbol2scm ("assign"))) tg->set_property (scm_car (entry), scm_cadr (entry)); - else if (type == ly_symbol2scm ("apply")) + else if (scm_is_eq (type, ly_symbol2scm ("apply"))) scm_apply_1 (scm_car (entry), tg->self_scm (), scm_cdr (entry)); - else if (type == ly_symbol2scm ("unset")) + else if (scm_is_eq (type, ly_symbol2scm ("unset"))) tg->unset_property (scm_car (entry)); } } diff --git a/lily/context-scheme.cc b/lily/context-scheme.cc index a3462354e0..d4bd77296c 100644 --- a/lily/context-scheme.cc +++ b/lily/context-scheme.cc @@ -103,7 +103,7 @@ LY_DEFINE (ly_context_property, "ly:context-property", Context *t = Context::unsmob (context); SCM result = t->get_property (sym); - return def != SCM_UNDEFINED && scm_is_null (result) ? def : result; + return !SCM_UNBNDP (def) && scm_is_null (result) ? def : result; } LY_DEFINE (ly_context_set_property_x, "ly:context-set-property!", diff --git a/lily/context.cc b/lily/context.cc index caac314bf7..9dad38f269 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -34,7 +34,7 @@ bool Context::is_removable () const { - return context_list_ == SCM_EOL && ! client_count_ + return scm_is_null (context_list_) && ! client_count_ && !dynamic_cast<Global_context const *> (daddy_context_); } @@ -181,7 +181,7 @@ Context::find_create_context (SCM n, const string &id, SCM operations) if (Context *existing = find_context_below (this, n, id)) return existing; - if (n == ly_symbol2scm ("Bottom")) + if (scm_is_eq (n, ly_symbol2scm ("Bottom"))) { Context *tg = get_default_interpreter (id); return tg; @@ -248,7 +248,7 @@ Context::set_property_from_event (SCM sev) unset_property (sym); return; } - + bool ok = true; ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?")); @@ -341,7 +341,7 @@ Context::path_to_acceptable_context (SCM name) const // but the Context_def expects to see elements of the form ('accepts symbol). SCM accepts = SCM_EOL; for (SCM s = definition_mods_; scm_is_pair (s); s = scm_cdr (s)) - if (scm_caar (s) == ly_symbol2scm ("accepts")) + if (scm_is_eq (scm_caar (s), ly_symbol2scm ("accepts"))) { SCM elt = scm_list_2 (scm_caar (s), scm_string_to_symbol (scm_cadar (s))); accepts = scm_cons (elt, accepts); @@ -514,7 +514,7 @@ Context::is_alias (SCM sym) const if (scm_is_eq (sym, context_name_symbol ())) return true; - return scm_c_memq (sym, aliases_) != SCM_BOOL_F; + return scm_is_true (scm_c_memq (sym, aliases_)); } void diff --git a/lily/cue-clef-engraver.cc b/lily/cue-clef-engraver.cc index 33cceff59c..383c9a1b1f 100644 --- a/lily/cue-clef-engraver.cc +++ b/lily/cue-clef-engraver.cc @@ -171,9 +171,9 @@ Cue_clef_engraver::inspect_clef_properties () SCM clefpos = get_property ("cueClefPosition"); SCM transposition = get_property ("cueClefTransposition"); - if (scm_equal_p (glyph, prev_glyph_) == SCM_BOOL_F - || scm_equal_p (clefpos, prev_cpos_) == SCM_BOOL_F - || scm_equal_p (transposition, prev_transposition_) == SCM_BOOL_F) + if (!ly_is_equal (glyph, prev_glyph_) + || !ly_is_equal (clefpos, prev_cpos_) + || !ly_is_equal (transposition, prev_transposition_)) { set_glyph (); if (scm_is_string (glyph)) diff --git a/lily/directional-element-interface.cc b/lily/directional-element-interface.cc index 5dee7ed04e..eb342fe1ac 100644 --- a/lily/directional-element-interface.cc +++ b/lily/directional-element-interface.cc @@ -25,7 +25,7 @@ Direction get_grob_direction (Grob *me) { SCM d = me->get_property ("direction"); - if (d == ly_symbol2scm ("calculation-in-progress")) + if (scm_is_eq (d, ly_symbol2scm ("calculation-in-progress"))) { programming_error ("Grob direction requested while calculation in" " progress."); diff --git a/lily/dispatcher.cc b/lily/dispatcher.cc index b268218f47..efb3ca506c 100644 --- a/lily/dispatcher.cc +++ b/lily/dispatcher.cc @@ -244,7 +244,7 @@ Dispatcher::remove_listener (Listener l, SCM ev_class) { SCM list = scm_hashq_ref (listeners_, ev_class, SCM_EOL); - if (list == SCM_EOL) + if (scm_is_null (list)) { programming_error ("remove_listener called with incorrect class."); return; @@ -292,7 +292,7 @@ Dispatcher::register_as_listener (Dispatcher *disp) int priority = ++disp->priority_count_; // Don't register twice to the same dispatcher. - if (scm_assq (disp->self_scm (), dispatchers_) != SCM_BOOL_F) + if (scm_is_true (scm_assq (disp->self_scm (), dispatchers_))) { warning (_ ("Already listening to dispatcher, ignoring request")); return; diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 853a7715a2..1ec7baa059 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -217,8 +217,9 @@ Dot_column::calc_positioning_done (SCM smob) cfg.remove_collision (p); cfg[p] = dp; - if (Staff_symbol_referencer::on_line (dp.dot_, p) && - dp.dot_->get_property ("style") != ly_symbol2scm ("kievan")) + if (Staff_symbol_referencer::on_line (dp.dot_, p) + && !scm_is_eq (dp.dot_->get_property ("style"), + ly_symbol2scm ("kievan"))) cfg.remove_collision (p); } diff --git a/lily/double-percent-repeat-engraver.cc b/lily/double-percent-repeat-engraver.cc index 2569adbf14..d85648293e 100644 --- a/lily/double-percent-repeat-engraver.cc +++ b/lily/double-percent-repeat-engraver.cc @@ -73,7 +73,7 @@ Double_percent_repeat_engraver::process_music () percent_event_->self_scm ()); SCM count = percent_event_->get_property ("repeat-count"); - if (count != SCM_EOL && to_boolean (get_property ("countPercentRepeats")) + if (!scm_is_null (count) && to_boolean (get_property ("countPercentRepeats")) && check_repeat_count_visibility (context (), count)) { Item *double_percent_counter diff --git a/lily/drum-note-engraver.cc b/lily/drum-note-engraver.cc index 1721dae62f..09a58fa24b 100644 --- a/lily/drum-note-engraver.cc +++ b/lily/drum-note-engraver.cc @@ -76,7 +76,7 @@ Drum_notes_engraver::process_music () SCM defn = SCM_EOL; - if (scm_hash_table_p (tab) == SCM_BOOL_T) + if (to_boolean (scm_hash_table_p (tab))) defn = scm_hashq_ref (tab, drum_type, SCM_EOL); if (scm_is_pair (defn)) @@ -85,7 +85,7 @@ Drum_notes_engraver::process_music () SCM style = scm_car (defn); SCM script = scm_cadr (defn); - if (scm_integer_p (pos) == SCM_BOOL_T) + if (scm_is_integer (pos)) note->set_property ("staff-position", pos); if (scm_is_symbol (style)) note->set_property ("style", style); diff --git a/lily/drum-note-performer.cc b/lily/drum-note-performer.cc index 6c565cd8e0..4b74f791cf 100644 --- a/lily/drum-note-performer.cc +++ b/lily/drum-note-performer.cc @@ -55,7 +55,7 @@ Drum_note_performer::process_music () SCM defn = SCM_EOL; if (scm_is_symbol (sym) - && (scm_hash_table_p (tab) == SCM_BOOL_T)) + && to_boolean (scm_hash_table_p (tab))) defn = scm_hashq_ref (tab, sym, SCM_EOL); if (Pitch *pit = Pitch::unsmob (defn)) diff --git a/lily/duration-scheme.cc b/lily/duration-scheme.cc index 59a2fdcba8..55fbf382b2 100644 --- a/lily/duration-scheme.cc +++ b/lily/duration-scheme.cc @@ -67,7 +67,7 @@ LY_DEFINE (ly_make_duration, "ly:make-duration", LY_ASSERT_TYPE (scm_is_integer, length, 1); int dots = 0; - if (dotcount != SCM_UNDEFINED) + if (!SCM_UNBNDP (dotcount)) { LY_ASSERT_TYPE (scm_is_integer, dotcount, 2); dots = scm_to_int (dotcount); diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 8be008f8fb..0bbe69f075 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -107,7 +107,7 @@ Dynamic_engraver::get_property_setting (Stream_event *evt, char const *ctxprop) { SCM spanner_type = evt->get_property (evprop); - if (spanner_type == SCM_EOL) + if (scm_is_null (spanner_type)) spanner_type = get_property (ctxprop); return spanner_type; } @@ -141,7 +141,7 @@ Dynamic_engraver::process_music () SCM cresc_type = get_property_setting (current_span_event_, "span-type", (start_type + "Spanner").c_str ()); - if (cresc_type == ly_symbol2scm ("text")) + if (scm_is_eq (cresc_type, ly_symbol2scm ("text"))) { current_spanner_ = make_spanner ("DynamicTextSpanner", @@ -156,12 +156,13 @@ Dynamic_engraver::process_music () early: this allows dynamics to be spaced individually instead of being linked together. */ - if (current_spanner_->get_property ("style") == ly_symbol2scm ("none")) + if (scm_is_eq (current_spanner_->get_property ("style"), + ly_symbol2scm ("none"))) current_spanner_->set_property ("spanner-broken", SCM_BOOL_T); } else { - if (cresc_type != ly_symbol2scm ("hairpin")) + if (!scm_is_eq (cresc_type, ly_symbol2scm ("hairpin"))) { string as_string = ly_scm_write_string (cresc_type); current_span_event_ @@ -244,9 +245,9 @@ Dynamic_engraver::get_spanner_type (Stream_event *ev) string type; SCM start_sym = scm_car (ev->get_property ("class")); - if (start_sym == ly_symbol2scm ("decrescendo-event")) + if (scm_is_eq (start_sym, ly_symbol2scm ("decrescendo-event"))) type = "decrescendo"; - else if (start_sym == ly_symbol2scm ("crescendo-event")) + else if (scm_is_eq (start_sym, ly_symbol2scm ("crescendo-event"))) type = "crescendo"; else programming_error ("unknown dynamic spanner type"); diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc index 3fc8cf2f85..50009bd53d 100644 --- a/lily/engraver-group.cc +++ b/lily/engraver-group.cc @@ -109,7 +109,7 @@ Engraver_group::acknowledge_grobs () Engraver_dispatch_list *dispatch = Engraver_dispatch_list::unsmob (acklist); - if (acklist == SCM_BOOL_F) + if (scm_is_false (acklist)) { SCM ifaces = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta)); diff --git a/lily/engraver.cc b/lily/engraver.cc index 959a778454..fd352d836d 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -56,7 +56,7 @@ Engraver::make_grob_info (Grob *e, SCM cause) { cause = m->to_event ()->unprotect (); } - if (e->get_property ("cause") == SCM_EOL + if (scm_is_null (e->get_property ("cause")) && (Stream_event::is_smob (cause) || Grob::is_smob (cause))) e->set_property ("cause", cause); @@ -125,11 +125,11 @@ Engraver::internal_make_grob (SCM symbol, SCM handle = scm_sloppy_assq (ly_symbol2scm ("meta"), props); SCM klass = scm_cdr (scm_sloppy_assq (ly_symbol2scm ("class"), scm_cdr (handle))); - if (klass == ly_symbol2scm ("Item")) + if (scm_is_eq (klass, ly_symbol2scm ("Item"))) grob = new Item (props); - else if (klass == ly_symbol2scm ("Spanner")) + else if (scm_is_eq (klass, ly_symbol2scm ("Spanner"))) grob = new Spanner (props); - else if (klass == ly_symbol2scm ("Paper_column")) + else if (scm_is_eq (klass, ly_symbol2scm ("Paper_column"))) grob = new Paper_column (props); assert (grob); @@ -174,7 +174,7 @@ Engraver::internal_make_spanner (SCM x, SCM cause, char const *name, bool ly_is_grob_cause (SCM obj) { - return Grob::is_smob (obj) || Stream_event::is_smob (obj) || (obj == SCM_EOL); + return Grob::is_smob (obj) || Stream_event::is_smob (obj) || scm_is_null (obj); } #include "translator.icc" diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index 67e4d6072e..00f571ed3a 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -433,7 +433,7 @@ Figured_bass_engraver::create_grobs () Align_interface::add_element (alignment_, group.group_); } - if (scm_memq (group.number_, get_property ("implicitBassFigures")) != SCM_BOOL_F) + if (scm_is_true (scm_memq (group.number_, get_property ("implicitBassFigures")))) { item->set_property ("transparent", SCM_BOOL_T); item->set_property ("implicit", SCM_BOOL_T); diff --git a/lily/font-interface.cc b/lily/font-interface.cc index 4e6f5aac05..8f1e2c3b52 100644 --- a/lily/font-interface.cc +++ b/lily/font-interface.cc @@ -45,7 +45,7 @@ Font_interface::music_font_alist_chain (Grob *g) { SCM defaults = g->layout ()->lookup_variable (ly_symbol2scm ("font-defaults")); - if (defaults == SCM_UNDEFINED) + if (SCM_UNBNDP (defaults)) defaults = SCM_EOL; return g->get_property_alist_chain (defaults); } @@ -55,7 +55,7 @@ Font_interface::text_font_alist_chain (Grob *g) { SCM defaults = g->layout ()->lookup_variable (ly_symbol2scm ("text-font-defaults")); - if (defaults == SCM_UNDEFINED) + if (SCM_UNBNDP (defaults)) defaults = SCM_EOL; return g->get_property_alist_chain (defaults); } diff --git a/lily/font-select.cc b/lily/font-select.cc index a5957ba715..9950d1a747 100644 --- a/lily/font-select.cc +++ b/lily/font-select.cc @@ -40,7 +40,7 @@ get_font_by_design_size (Output_def *layout, Real requested, { SCM entry = scm_c_vector_ref (font_vector, i); - if (scm_promise_p (entry) == SCM_BOOL_T) + if (to_boolean (scm_promise_p (entry))) { Font_metric *fm = Font_metric::unsmob (scm_force (entry)); size = fm->design_size (); diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index 4e11cc1feb..d5fe89024c 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -89,7 +89,7 @@ LY_DEFINE (ly_gulp_file, "ly:gulp-file", { LY_ASSERT_TYPE (scm_is_string, name, 1); int sz = INT_MAX; - if (size != SCM_UNDEFINED) + if (!SCM_UNBNDP (size)) { LY_ASSERT_TYPE (scm_is_number, size, 2); sz = scm_to_int (size); @@ -128,10 +128,10 @@ LY_DEFINE (ly_assoc_get, "ly:assoc-get", if (scm_is_pair (handle)) return scm_cdr (handle); - if (default_value == SCM_UNDEFINED) + if (SCM_UNBNDP (default_value)) default_value = SCM_BOOL_F; - if (strict_checking == SCM_BOOL_T) + if (to_boolean (strict_checking)) { string key_string = ly_scm2string (scm_object_to_string (key, SCM_UNDEFINED)); @@ -223,7 +223,7 @@ LY_DEFINE (ly_number_2_string, "ly:number->string", char str[400]; // ugh. - if (scm_exact_p (s) == SCM_BOOL_F) + if (scm_is_false (scm_exact_p (s))) { Real r (scm_to_double (s)); if (isinf (r) || isnan (r)) @@ -368,7 +368,7 @@ LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get", return ly_chain_assoc_get (key, scm_cdr (achain), default_value); } - if (strict_checking == SCM_BOOL_T) + if (to_boolean (strict_checking)) { string key_string = ly_scm2string (scm_object_to_string (key, SCM_UNDEFINED)); @@ -381,7 +381,7 @@ LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get", + default_value_string + "'."); } - return default_value == SCM_UNDEFINED ? SCM_BOOL_F : default_value; + return SCM_UNBNDP (default_value) ? SCM_BOOL_F : default_value; } LY_DEFINE (ly_stderr_redirect, "ly:stderr-redirect", @@ -471,7 +471,7 @@ LY_DEFINE (ly_truncate_list_x, "ly:truncate-list!", string format_single_argument (SCM arg, int precision, bool escape = false) { - if (scm_is_integer (arg) && scm_exact_p (arg) == SCM_BOOL_T) + if (scm_is_integer (arg) && scm_is_true (scm_exact_p (arg))) return (String_convert::int_string (scm_to_int (arg))); else if (scm_is_number (arg)) { @@ -570,11 +570,11 @@ LY_DEFINE (ly_format, "ly:format", for (; scm_is_pair (s); s = scm_cdr (s)) { results.push_back (format_single_argument (scm_car (s), precision)); - if (scm_cdr (s) != SCM_EOL) + if (!scm_is_null (scm_cdr (s))) results.push_back (" "); } - if (s != SCM_EOL) + if (!scm_is_null (s)) results.push_back (format_single_argument (s, precision)); } diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc index 35ff94228a..c7744d1f4b 100644 --- a/lily/glissando-engraver.cc +++ b/lily/glissando-engraver.cc @@ -110,7 +110,7 @@ Glissando_engraver::acknowledge_note_column (Grob_info info) { extract_grob_set (g, "note-heads", note_heads); SCM map = get_property ("glissandoMap"); - if (map == SCM_EOL) + if (scm_is_null (map)) for (vsize i = 0; i < note_heads.size (); i++) { note_column_1.push_back (i); diff --git a/lily/grob-interface.cc b/lily/grob-interface.cc index 6c99c849ed..ea9b81ad9f 100644 --- a/lily/grob-interface.cc +++ b/lily/grob-interface.cc @@ -48,7 +48,7 @@ SCM add_interface (char const *cxx_name, void check_interfaces_for_property (Grob const *me, SCM sym) { - if (sym == ly_symbol2scm ("meta")) + if (scm_is_eq (sym, ly_symbol2scm ("meta"))) { /* otherwise we get in a nasty recursion loop. @@ -63,7 +63,7 @@ check_interfaces_for_property (Grob const *me, SCM sym) for (; !found && scm_is_pair (ifs); ifs = scm_cdr (ifs)) { SCM iface = scm_hashq_ref (all_ifaces, scm_car (ifs), SCM_BOOL_F); - if (iface == SCM_BOOL_F) + if (scm_is_false (iface)) { string msg = to_string (_f ("Unknown interface `%s'", ly_symbol2string (scm_car (ifs)).c_str ())); @@ -71,7 +71,7 @@ check_interfaces_for_property (Grob const *me, SCM sym) continue; } - found = found || (scm_c_memq (sym, scm_caddr (iface)) != SCM_BOOL_F); + found = found || scm_is_true (scm_c_memq (sym, scm_caddr (iface))); } if (!found) diff --git a/lily/grob-property.cc b/lily/grob-property.cc index 9c6590c5ec..1c755bf7b0 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -125,7 +125,7 @@ Grob::internal_set_value_on_alist (SCM *alist, SCM sym, SCM v) if (!ly_is_procedure (v) && !Simple_closure::is_smob (v) && !Unpure_pure_container::is_smob (v) - && v != ly_symbol2scm ("calculation-in-progress")) + && !scm_is_eq (v, ly_symbol2scm ("calculation-in-progress"))) type_check_assignment (sym, v, ly_symbol2scm ("backend-type?")); check_interfaces_for_property (this, sym); @@ -143,7 +143,7 @@ Grob::internal_get_property_data (SCM sym) const #endif SCM handle = scm_sloppy_assq (sym, mutable_property_alist_); - if (handle != SCM_BOOL_F) + if (scm_is_true (handle)) return scm_cdr (handle); handle = scm_sloppy_assq (sym, immutable_property_alist_); @@ -158,7 +158,7 @@ Grob::internal_get_property_data (SCM sym) const check_interfaces_for_property (this, sym); } - return (handle == SCM_BOOL_F) ? SCM_EOL : scm_cdr (handle); + return scm_is_false (handle) ? SCM_EOL : scm_cdr (handle); } SCM @@ -167,7 +167,7 @@ Grob::internal_get_property (SCM sym) const SCM val = get_property_data (sym); #ifndef NDEBUG - if (val == ly_symbol2scm ("calculation-in-progress")) + if (scm_is_eq (val, ly_symbol2scm ("calculation-in-progress"))) { programming_error (to_string ("cyclic dependency: calculation-in-progress encountered for #'%s (%s)", ly_symbol2string (sym).c_str (), @@ -252,11 +252,11 @@ Grob::try_callback_on_alist (SCM *alist, SCM sym, SCM proc) grob_property_callback_stack = scm_cdr (grob_property_callback_stack); #endif - if (value == SCM_UNSPECIFIED) + if (scm_is_eq (value, SCM_UNSPECIFIED)) { value = get_property_data (sym); - assert (value == SCM_EOL || value == marker); - if (value == marker) + assert (scm_is_null (value) || scm_is_eq (value, marker)); + if (scm_is_eq (value, marker)) *alist = scm_assq_remove_x (*alist, sym); } else @@ -300,7 +300,7 @@ Grob::internal_get_object (SCM sym) const SCM s = scm_sloppy_assq (sym, object_alist_); - if (s != SCM_BOOL_F) + if (scm_is_true (s)) { SCM val = scm_cdr (s); if (ly_is_procedure (val) @@ -326,7 +326,7 @@ Grob::is_live () const bool Grob::internal_has_interface (SCM k) { - return scm_c_memq (k, interfaces_) != SCM_BOOL_F; + return scm_is_true (scm_c_memq (k, interfaces_)); } SCM diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index 238a0af751..2a42439fb5 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -94,11 +94,11 @@ LY_DEFINE (ly_grob_pure_property, "ly:grob-pure-property", LY_ASSERT_TYPE (ly_is_symbol, sym, 2); LY_ASSERT_TYPE (scm_is_integer, beg, 3); LY_ASSERT_TYPE (scm_is_integer, end, 4); - if (val == SCM_UNDEFINED) + if (SCM_UNBNDP (val)) val = SCM_EOL; SCM retval = sc->internal_get_pure_property (sym, scm_to_int (beg), scm_to_int (end)); - if (retval == SCM_EOL) + if (scm_is_null (retval)) retval = val; return retval; @@ -117,7 +117,7 @@ LY_DEFINE (ly_grob_pure_height, "ly:grob-pure-height", LY_ASSERT_SMOB (Grob, refp, 2); LY_ASSERT_TYPE (scm_is_integer, beg, 3); LY_ASSERT_TYPE (scm_is_integer, end, 4); - if (val == SCM_UNDEFINED) + if (SCM_UNBNDP (val)) val = SCM_EOL; Interval retval = sc->pure_height (ref, scm_to_int (beg), scm_to_int (end)); @@ -135,11 +135,11 @@ LY_DEFINE (ly_grob_property, "ly:grob-property", LY_ASSERT_SMOB (Grob, grob, 1); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); - if (val == SCM_UNDEFINED) + if (SCM_UNBNDP (val)) val = SCM_EOL; SCM retval = sc->get_property (sym); - if (retval == SCM_EOL) + if (scm_is_null (retval)) retval = val; return retval; @@ -206,10 +206,10 @@ LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain", LY_ASSERT_SMOB (Grob, grob, 1); - if (global == SCM_UNDEFINED) + if (SCM_UNBNDP (global)) { global = sc->layout ()->lookup_variable (ly_symbol2scm ("font-defaults")); - if (global == SCM_UNDEFINED) + if (SCM_UNBNDP (global)) global = SCM_EOL; } diff --git a/lily/grob.cc b/lily/grob.cc index 660a34d072..99d027f2f3 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -75,17 +75,17 @@ Grob::Grob (SCM basicprops) } } - if (get_property_data ("X-extent") == SCM_EOL) + if (scm_is_null (get_property_data ("X-extent"))) set_property ("X-extent", Grob::stencil_width_proc); - if (get_property_data ("Y-extent") == SCM_EOL) + if (scm_is_null (get_property_data ("Y-extent"))) set_property ("Y-extent", Unpure_pure_container::make_smob (Grob::stencil_height_proc, Grob::pure_stencil_height_proc)); - if (get_property_data ("vertical-skylines") == SCM_EOL) + if (scm_is_null (get_property_data ("vertical-skylines"))) set_property ("vertical-skylines", Unpure_pure_container::make_smob (Grob::simple_vertical_skylines_from_extents_proc, Grob::pure_simple_vertical_skylines_from_extents_proc)); - if (get_property_data ("horizontal-skylines") == SCM_EOL) + if (scm_is_null (get_property_data ("horizontal-skylines"))) set_property ("horizontal-skylines", Unpure_pure_container::make_smob (Grob::simple_horizontal_skylines_from_extents_proc, Grob::pure_simple_horizontal_skylines_from_extents_proc)); diff --git a/lily/include/lily-guile-macros.hh b/lily/include/lily-guile-macros.hh index 5fc1c8e7dd..355bd58139 100644 --- a/lily/include/lily-guile-macros.hh +++ b/lily/include/lily-guile-macros.hh @@ -88,7 +88,7 @@ scm_or_str2symbol (SCM s) SCM value = cached; \ if (__builtin_constant_p ((x))) \ { \ - if (!cached) \ + if (!SCM_UNPACK (cached)) \ value = cached = scm_gc_protect_object (scm_or_str2symbol (x)); \ } \ else \ @@ -111,7 +111,7 @@ inline SCM ly_symbol2scm (char const *x) { return scm_from_utf8_symbol ((x)); } SCM value = cached; \ if (__builtin_constant_p ((x))) \ { \ - if (!cached) \ + if (!SCM_UNPACK (cached)) \ value = cached = \ scm_variable_ref (scm_c_module_lookup (global_lily_module, (x))); \ } \ diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 38709a14c5..b7cfabd675 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -99,7 +99,7 @@ SCM ly_hash_table_keys (SCM tab); SCM ly_assoc_prepend_x (SCM alist, SCM key, SCM val); inline bool ly_is_list (SCM x) { return scm_is_true (scm_list_p (x)); } -inline bool ly_cheap_is_list (SCM x) { return scm_is_pair (x) || x == SCM_EOL; } +inline bool ly_cheap_is_list (SCM x) { return scm_is_pair (x) || scm_is_null (x); } inline bool ly_is_procedure (SCM x) { return scm_is_true (scm_procedure_p (x)); } inline bool ly_is_port (SCM x) { return scm_is_true (scm_port_p (x)); } diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index 41c68a5a14..f65c295833 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -89,8 +89,8 @@ Instrument_name_engraver::consider_start_spanner () if ((Text_interface::is_markup (long_text) || Text_interface::is_markup (short_text)) && (!text_spanner_ - || short_text_ != short_text - || long_text_ != long_text)) + || !scm_is_eq (short_text_, short_text) + || !scm_is_eq (long_text_, long_text))) { if (text_spanner_) stop_spanner (); diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 72ed8ad510..971f553172 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -82,7 +82,7 @@ Key_engraver::create_key (bool is_default) SCM key = get_property ("keyAlterations"); if ((to_boolean (get_property ("printKeyCancellation")) - || key == SCM_EOL) + || scm_is_null (key)) && !scm_is_eq (last, key)) { SCM restore = SCM_EOL; @@ -90,7 +90,7 @@ Key_engraver::create_key (bool is_default) { SCM new_alter_pair = scm_assoc (scm_caar (s), key); Rational old_alter = robust_scm2rational (scm_cdar (s), 0); - if (new_alter_pair == SCM_BOOL_F + if (scm_is_false (new_alter_pair) || ((ly_scm2rational (scm_cdr (new_alter_pair)) - old_alter) * old_alter < Rational (0))) { diff --git a/lily/lexer.ll b/lily/lexer.ll index 1dd9554d02..775cbdde0f 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -30,9 +30,9 @@ /* backup rules - after making a change to the lexer rules, run + after making a change to the lexer rules, run flex -b <this lexer file> - and make sure that + and make sure that lex.backup contains no backup states, but only the reminder Compressed tables always back up. @@ -119,7 +119,7 @@ SCM (* scm_parse_error_handler) (void *); %option debug %option yyclass="Lily_lexer" %option stack -%option never-interactive +%option never-interactive %option warn %x chords @@ -346,7 +346,7 @@ BOM_UTF8 \357\273\277 yy_pop_state (); } else { LexerError (_ ("string expected after \\include").c_str ()); - if (sval != SCM_UNDEFINED) { + if (!SCM_UNBNDP (sval)) { SCM err = scm_current_error_port (); scm_puts ("This value was found instead: ", err); scm_display (sval, err); @@ -387,7 +387,7 @@ BOM_UTF8 \357\273\277 hi.step_forward (); SCM sval = ly_parse_scm (hi, be_safe_global && is_main_input_, parser_); - if (sval == SCM_UNDEFINED) + if (SCM_UNBNDP (sval)) error_level_ = 1; int n = hi.end () - hi.start (); @@ -809,7 +809,7 @@ BOM_UTF8 \357\273\277 %% -/* Make the lexer generate a token of the given type as the next token. +/* Make the lexer generate a token of the given type as the next token. TODO: make it possible to define a value for the token as well */ void Lily_lexer::push_extra_token (Input const &where, int token_type, SCM scm) @@ -918,10 +918,10 @@ Lily_lexer::scan_escaped_word (const string &str) m->set_spot (override_input (here_input ())); } - if (sid != SCM_UNDEFINED) + if (!SCM_UNBNDP (sid)) return scan_scm_id (sid); - string msg (_f ("unknown escaped string: `\\%s'", str)); + string msg (_f ("unknown escaped string: `\\%s'", str)); LexerError (msg.c_str ()); yylval = ly_string2scm (str); @@ -938,10 +938,10 @@ Lily_lexer::scan_shorthand (const string &str) m->set_spot (override_input (here_input ())); } - if (sid != SCM_UNDEFINED) + if (!SCM_UNBNDP (sid)) return scan_scm_id (sid); - string msg (_f ("undefined character or shorthand: %s", str)); + string msg (_f ("undefined character or shorthand: %s", str)); LexerError (msg.c_str ()); yylval = ly_string2scm (str); @@ -985,7 +985,7 @@ Lily_lexer::scan_scm_id (SCM sid) optional = SCM_CDR (cs); cs = SCM_CAR (cs); } - + if (ly_is_procedure (cs)) push_extra_token (here_input (), EXPECT_SCM, cs); else @@ -1010,7 +1010,7 @@ Lily_lexer::scan_bare_word (const string &str) SCM handle = SCM_BOOL_F; if (scm_is_pair (pitchname_tab_stack_)) handle = scm_hashq_get_handle (scm_cdar (pitchname_tab_stack_), sym); - + if (scm_is_pair (handle)) { yylval = scm_cdr (handle); if (Pitch::is_smob (yylval)) @@ -1019,7 +1019,7 @@ Lily_lexer::scan_bare_word (const string &str) return DRUM_PITCH; } else if ((YYSTATE == chords) - && (handle = scm_hashq_get_handle (chordmodifier_tab_, sym))!= SCM_BOOL_F) + && scm_is_true (handle = scm_hashq_get_handle (chordmodifier_tab_, sym))) { yylval = scm_cdr (handle); return CHORD_MODIFIER; @@ -1100,7 +1100,7 @@ Lily_lexer::eval_scm (SCM readerdata, Input hi, char extra_token) if (!Input::is_smob (m->get_property ("origin"))) m->set_spot (override_input (here_input ())); } - + int token; switch (extra_token) { case '$': @@ -1240,7 +1240,7 @@ Lily_lexer::YYText_utf8 () /* urg, belong to string (_convert) - and should be generalised + and should be generalised */ void strip_leading_white (string&s) @@ -1256,8 +1256,8 @@ strip_leading_white (string&s) void strip_trailing_white (string&s) { - ssize i = s.length (); - while (i--) + ssize i = s.length (); + while (i--) if (!isspace (s[i])) break; @@ -1280,7 +1280,7 @@ is_valid_version (string s) return false; } if (ver < oldest_version) - { + { non_fatal_error (_f ("file too old: %s (oldest supported: %s)", ver.to_string (), oldest_version.to_string ())); non_fatal_error (_ ("consider updating the input with the convert-ly script")); return false; @@ -1293,7 +1293,7 @@ is_valid_version (string s) } return true; } - + /* substitute _ diff --git a/lily/ligature-engraver.cc b/lily/ligature-engraver.cc index 4fde711055..b647e02edd 100644 --- a/lily/ligature-engraver.cc +++ b/lily/ligature-engraver.cc @@ -203,7 +203,7 @@ Ligature_engraver::acknowledge_ligature_head (Grob_info info) if (ligature_) { primitives_.push_back (info); - if (info.grob () && brew_ligature_primitive_proc != SCM_EOL) + if (info.grob () && !scm_is_null (brew_ligature_primitive_proc)) info.grob ()->set_property ("stencil", brew_ligature_primitive_proc); } } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index dce8760836..6f7bf37f70 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -401,13 +401,13 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) { // If undefined, some internal function caused it...should never happen. - assert (val != SCM_UNDEFINED); + assert (!SCM_UNBNDP (val)); if (!scm_is_symbol (sym)) return false; SCM type = scm_object_property (sym, type_symbol); - if (type != SCM_EOL && !ly_is_procedure (type)) + if (!scm_is_null (type) && !ly_is_procedure (type)) { warning (_f ("cannot find property type-check for `%s' (%s).", ly_symbol2string (sym).c_str (), @@ -429,16 +429,16 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) TODO: should remove #f from allowed vals? */ - if (val == SCM_EOL || val == SCM_BOOL_F) + if (scm_is_null (val) || scm_is_false (val)) return true; - if (val != SCM_EOL + if (!scm_is_null (val) && ly_is_procedure (type) - && scm_call_1 (type, val) == SCM_BOOL_F) + && scm_is_false (scm_call_1 (type, val))) { SCM typefunc = ly_lily_module_constant ("type-name"); SCM type_name = scm_call_1 (typefunc, type); - + warning (_f ("type check for `%s' failed; value `%s' must be of type `%s'", ly_symbol2string (sym).c_str (), print_scm_val (val), @@ -564,7 +564,7 @@ robust_scm2string (SCM k, const string &s) int robust_scm2int (SCM k, int o) { - if (scm_integer_p (k) == SCM_BOOL_T) + if (scm_is_integer (k)) o = scm_to_int (k); return o; } @@ -572,7 +572,7 @@ robust_scm2int (SCM k, int o) vsize robust_scm2vsize (SCM k, vsize o) { - if (scm_integer_p (k) == SCM_BOOL_T) + if (scm_is_integer (k)) { int i = scm_to_int (k); if (i >= 0) diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 6c118979ae..3bb7921b2b 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -209,7 +209,7 @@ Lily_lexer::lookup_identifier_symbol (SCM sym) for (SCM s = scopes_; scm_is_pair (s); s = scm_cdr (s)) { SCM var = ly_module_lookup (scm_car (s), sym); - if (var != SCM_BOOL_F) + if (scm_is_true (var)) return scm_variable_ref (var); } @@ -281,7 +281,7 @@ Lily_lexer::set_identifier (SCM path, SCM val) if (scm_is_pair (path)) { SCM prev = ly_module_lookup (mod, sym); - if (prev != SCM_BOOL_F) + if (scm_is_true (prev)) val = nested_property_alist (scm_variable_ref (prev), path, val); } scm_module_define (mod, sym, val); diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index 8aedecbb0f..806cc62fd6 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -50,8 +50,8 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", out_file_name.ext_ = ""; out_file_name.root_ = ""; - if (ly_get_option (ly_symbol2scm ("gui")) != SCM_BOOL_T - && ly_get_option (ly_symbol2scm ("strip-output-dir")) == SCM_BOOL_T) + if (!to_boolean (ly_get_option (ly_symbol2scm ("gui"))) + && to_boolean (ly_get_option (ly_symbol2scm ("strip-output-dir")))) { out_file_name.dir_ = ""; } @@ -190,7 +190,7 @@ LY_DEFINE (ly_parser_lookup, "ly:parser-lookup", LY_ASSERT_TYPE (ly_is_symbol, symbol, 2); SCM val = parser->lexer_->lookup_identifier (ly_symbol2string (symbol)); - if (val != SCM_UNDEFINED) + if (!SCM_UNBNDP (val)) return val; else return SCM_EOL; diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 35e0309510..2d006f8d78 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -242,7 +242,7 @@ Output_def * get_paper (Lily_parser *parser) { SCM papers = parser->lexer_->lookup_identifier ("$papers"); - Output_def *layout = ((papers == SCM_UNDEFINED) || scm_is_null (papers)) + Output_def *layout = (SCM_UNBNDP (papers) || scm_is_null (papers)) ? 0 : Output_def::unsmob (scm_car (papers)); SCM default_paper = parser->lexer_->lookup_identifier ("$defaultpaper"); layout = layout ? layout : Output_def::unsmob (default_paper); diff --git a/lily/line-interface.cc b/lily/line-interface.cc index 30b1216f80..056587a1d9 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -200,20 +200,21 @@ Line_interface::line (Grob *me, Offset from, Offset to) * robust_scm2double (me->get_property ("thickness"), 1); SCM type = me->get_property ("style"); - if (type == ly_symbol2scm ("zigzag")) + if (scm_is_eq (type, ly_symbol2scm ("zigzag"))) return make_zigzag_line (me, from, to); - else if (type == ly_symbol2scm ("trill")) + else if (scm_is_eq (type, ly_symbol2scm ("trill"))) return make_trill_line (me, from, to); - else if (type == ly_symbol2scm ("none")) + else if (scm_is_eq (type, ly_symbol2scm ("none"))) return Stencil (); Stencil stencil; - if (type == ly_symbol2scm ("dashed-line") || type == ly_symbol2scm ("dotted-line")) + if (scm_is_eq (type, ly_symbol2scm ("dashed-line")) + || scm_is_eq (type, ly_symbol2scm ("dotted-line"))) { Real fraction - = type == ly_symbol2scm ("dotted-line") + = scm_is_eq (type, ly_symbol2scm ("dotted-line")) ? 0.0 : robust_scm2double (me->get_property ("dash-fraction"), 0.4); diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 5184d396a6..9b0e2bf33b 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -64,7 +64,7 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir) SCM bound_details = me->get_property ("bound-details"); SCM details = SCM_BOOL_F; - if (details == SCM_BOOL_F) + if (scm_is_false (details)) details = ly_assoc_get ((dir == LEFT) ? ly_symbol2scm ("left") : ly_symbol2scm ("right"), bound_details, SCM_BOOL_F); @@ -78,7 +78,7 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir) details = scm_append (scm_list_2 (extra, details)); } - if (details == SCM_BOOL_F) + if (scm_is_false (details)) details = ly_assoc_get (ly_symbol2scm ("default"), bound_details, SCM_EOL); SCM text = ly_assoc_get (ly_symbol2scm ("text"), details, SCM_BOOL_F); @@ -246,7 +246,7 @@ Line_spanner::calc_left_bound_info_and_text (SCM smob) SCM text = me->get_property ("text"); if (Text_interface::is_markup (text) && me->get_bound (LEFT)->break_status_dir () == CENTER - && ly_assoc_get (ly_symbol2scm ("stencil"), alist, SCM_BOOL_F) == SCM_BOOL_F) + && scm_is_false (ly_assoc_get (ly_symbol2scm ("stencil"), alist, SCM_BOOL_F))) { Output_def *layout = me->layout (); SCM properties = Font_interface::text_font_alist_chain (me); diff --git a/lily/ly-module.cc b/lily/ly-module.cc index 2b91e8583e..3a3f39450c 100644 --- a/lily/ly-module.cc +++ b/lily/ly-module.cc @@ -100,7 +100,7 @@ entry_to_alist (void * /* closure */, SCM val, SCM result) { - if (scm_variable_bound_p (val) == SCM_BOOL_T) + if (to_boolean (scm_variable_bound_p (val))) return scm_cons (scm_cons (key, scm_variable_ref (val)), result); programming_error ("unbound variable in module"); return result; diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 6eb7ee321d..52a6835953 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -140,8 +140,8 @@ Mark_engraver::process_music () if (!scm_is_number (m)) m = get_property ("rehearsalMark"); - if (scm_integer_p (m) == SCM_BOOL_T - && scm_exact_p (m) == SCM_BOOL_T) + if (scm_is_integer (m) + && scm_is_true (scm_exact_p (m))) { int mark_count = scm_to_int (m); mark_count++; diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index ab1618a37d..050cc465f6 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -48,9 +48,9 @@ Measure_grouping::print (SCM grob) /* TODO: use line interface */ - if (which == ly_symbol2scm ("bracket")) + if (scm_is_eq (which, ly_symbol2scm ("bracket"))) m = Lookup::bracket (X_AXIS, iv, t, -height, t); - else if (which == ly_symbol2scm ("triangle")) + else if (scm_is_eq (which, ly_symbol2scm ("triangle"))) m = Lookup::triangle (iv, t, height); m.align_to (Y_AXIS, DOWN); diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc index 036ce027af..42f5270cc5 100644 --- a/lily/mensural-ligature.cc +++ b/lily/mensural-ligature.cc @@ -117,7 +117,7 @@ Stencil internal_brew_primitive (Grob *me) { SCM primitive_scm = me->get_property ("primitive"); - if (primitive_scm == SCM_EOL) + if (scm_is_null (primitive_scm)) { programming_error ("Mensural_ligature:" " undefined primitive -> ignoring grob"); diff --git a/lily/metronome-engraver.cc b/lily/metronome-engraver.cc index 841ae6df94..279f8f721c 100644 --- a/lily/metronome-engraver.cc +++ b/lily/metronome-engraver.cc @@ -71,8 +71,7 @@ Metronome_mark_engraver::listen_tempo_change (Stream_event *ev) static bool safe_is_member (SCM scm, SCM lst) { - return scm_list_p (lst) == SCM_BOOL_T - && scm_member (scm, lst) != SCM_BOOL_F; + return ly_is_list (lst) && scm_is_true (scm_member (scm, lst)); } void @@ -81,8 +80,8 @@ Metronome_mark_engraver::acknowledge_break_aligned (Grob_info info) Grob *g = info.grob (); if (text_ - && g->get_property ("break-align-symbol") - == ly_symbol2scm ("staff-bar")) + && scm_is_eq (g->get_property ("break-align-symbol"), + ly_symbol2scm ("staff-bar"))) bar_ = g; else if (text_ && !support_ diff --git a/lily/midi-item.cc b/lily/midi-item.cc index b19527f5bf..d85161676c 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -86,7 +86,7 @@ Midi_instrument::to_string () const SCM proc = ly_lily_module_constant ("midi-program"); SCM program = scm_call_1 (proc, ly_symbol2scm (audio_->str_.c_str ())); - found = (program != SCM_BOOL_F); + found = (scm_is_true (program)); if (found) program_byte = (Byte) scm_to_int (program); else diff --git a/lily/module-scheme.cc b/lily/module-scheme.cc index 67f642ec08..f926c44c02 100644 --- a/lily/module-scheme.cc +++ b/lily/module-scheme.cc @@ -34,7 +34,7 @@ module_define_closure_func (void *closure, SCM /* result */) { SCM module = (SCM) closure; - if (scm_variable_bound_p (val) == SCM_BOOL_T) + if (to_boolean (scm_variable_bound_p (val))) scm_module_define (module, key, scm_variable_ref (val)); return SCM_EOL; } @@ -92,11 +92,11 @@ LY_DEFINE (ly_modules_lookup, "ly:modules-lookup", { SCM mod = scm_car (s); SCM v = ly_module_lookup (mod, sym); - if (SCM_VARIABLEP (v) && SCM_VARIABLE_REF (v) != SCM_UNDEFINED) + if (SCM_VARIABLEP (v) && !SCM_UNBNDP (SCM_VARIABLE_REF (v))) return scm_variable_ref (v); } - if (def != SCM_UNDEFINED) + if (!SCM_UNBNDP (def)) return def; return SCM_BOOL_F; } diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index f8a541cf6f..045359f7e9 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -132,7 +132,8 @@ Multi_measure_rest_engraver::process_music () Grob *last = 0; for (vsize i = 0; i < numbers_.size (); i++) { - if (scm_from_int (d) == numbers_[i]->get_property ("direction")) + if (scm_is_eq (scm_from_int (d), + numbers_[i]->get_property ("direction"))) { if (last) Side_position_interface::add_support (numbers_[i], last); @@ -231,7 +232,7 @@ Multi_measure_rest_engraver::start_translation_timestep () numbers_.clear (); Grob *last = last_numbers_.size () ? last_numbers_[0] : 0; - if (last && last->get_property ("text") == SCM_EOL) + if (last && scm_is_null (last->get_property ("text"))) { SCM thres = get_property ("restNumberThreshold"); int t = 1; diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index e13d5bf17a..0321082a57 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -222,7 +222,7 @@ Multi_measure_rest::symbol_stencil (Grob *me, Real space) if (measure_count == 1) { - if (me->get_property ("staff-position") == SCM_EOL) + if (scm_is_null (me->get_property ("staff-position"))) { int dir = get_grob_direction (me); Real pos = Rest::staff_position_internal (me, mdl, dir); diff --git a/lily/music.cc b/lily/music.cc index 81f4a3d67f..6d8c9a281e 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -41,7 +41,7 @@ Music::internal_is_music_type (SCM k) const { SCM ifs = get_property ("types"); - return scm_c_memq (k, ifs) != SCM_BOOL_F; + return scm_is_true (scm_c_memq (k, ifs)); } Music::Music (SCM init) @@ -211,21 +211,21 @@ transpose_mutable (SCM alist, Pitch delta) { Pitch transposed = p->transposed (delta); - if (prop == ly_symbol2scm ("tonic")) + if (scm_is_eq (prop, ly_symbol2scm ("tonic"))) transposed = Pitch (-1, transposed.get_notename (), transposed.get_alteration ()); new_val = transposed.smobbed_copy (); } - else if (prop == ly_symbol2scm ("element")) + else if (scm_is_eq (prop, ly_symbol2scm ("element"))) { if (Music *m = Music::unsmob (val)) m->transpose (delta); } - else if (prop == ly_symbol2scm ("elements") - || prop == ly_symbol2scm ("articulations")) + else if (scm_is_eq (prop, ly_symbol2scm ("elements")) + || scm_is_eq (prop, ly_symbol2scm ("articulations"))) transpose_music_list (val, delta); - else if (prop == ly_symbol2scm ("pitch-alist") + else if (scm_is_eq (prop, ly_symbol2scm ("pitch-alist")) && scm_is_pair (val)) new_val = ly_transpose_key_alist (val, delta.smobbed_copy ()); diff --git a/lily/new-fingering-engraver.cc b/lily/new-fingering-engraver.cc index 55ff41ed4f..bcb7766a4c 100644 --- a/lily/new-fingering-engraver.cc +++ b/lily/new-fingering-engraver.cc @@ -119,7 +119,7 @@ New_fingering_engraver::acknowledge_rhythmic_head (Grob_info inf) // when we don't want them displayed. So don't make space // for them if 'stencil is #f Grob *g = make_item ("StringNumber", ev->self_scm ()); - if (g->get_property ("stencil") != SCM_BOOL_F) + if (scm_is_true (g->get_property ("stencil"))) add_fingering (inf.grob (), ly_symbol2scm ("StringNumber"), &string_numbers_, ev, note_ev); @@ -230,10 +230,10 @@ New_fingering_engraver::position_scripts (SCM orientations, vector_sort (*scripts, less<Finger_tuple> ()); - bool up_p = scm_c_memq (ly_symbol2scm ("up"), orientations) != SCM_BOOL_F; - bool down_p = scm_c_memq (ly_symbol2scm ("down"), orientations) != SCM_BOOL_F; - bool left_p = scm_c_memq (ly_symbol2scm ("left"), orientations) != SCM_BOOL_F; - bool right_p = scm_c_memq (ly_symbol2scm ("right"), orientations) != SCM_BOOL_F; + bool up_p = scm_is_true (scm_c_memq (ly_symbol2scm ("up"), orientations)); + bool down_p = scm_is_true (scm_c_memq (ly_symbol2scm ("down"), orientations)); + bool left_p = scm_is_true (scm_c_memq (ly_symbol2scm ("left"), orientations)); + bool right_p = scm_is_true (scm_c_memq (ly_symbol2scm ("right"), orientations)); Direction hordir = (right_p) ? RIGHT : LEFT; if (left_p || right_p) { diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 728f64dfae..6f205e3f22 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -209,8 +209,10 @@ check_meshing_chords (Grob *me, SCM up_style = head_up->get_property ("style"); SCM down_style = head_down->get_property ("style"); if (merge_possible - && (up_style == ly_symbol2scm ("fa") || up_style == ly_symbol2scm ("faThin")) - && (down_style == ly_symbol2scm ("fa") || down_style == ly_symbol2scm ("faThin"))) + && (scm_is_eq (up_style, ly_symbol2scm ("fa")) + || scm_is_eq (up_style, ly_symbol2scm ("faThin"))) + && (scm_is_eq (down_style, ly_symbol2scm ("fa")) + || scm_is_eq (down_style, ly_symbol2scm ("faThin")))) { Offset att = Offset (0.0, -1.0); head_up->set_property ("stem-attachment", ly_offset2scm (att)); diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index 255d5e2b18..255f7caa0d 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -162,7 +162,7 @@ Open_type_font::attachment_point (const string &glyph_name) const SCM entry = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F); Offset o; - if (entry == SCM_BOOL_F) + if (scm_is_false (entry)) return o; SCM char_alist = entry; @@ -196,7 +196,7 @@ Open_type_font::get_indexed_char_dimensions (size_t signed_idx) const SCM sym = ly_symbol2scm (name); SCM alist = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F); - if (alist != SCM_BOOL_F) + if (scm_is_true (alist)) { SCM bbox = scm_cdr (scm_assq (ly_symbol2scm ("bbox"), alist)); diff --git a/lily/output-def-scheme.cc b/lily/output-def-scheme.cc index 0b85c133a8..3c4ee413e7 100644 --- a/lily/output-def-scheme.cc +++ b/lily/output-def-scheme.cc @@ -36,9 +36,9 @@ LY_DEFINE (ly_output_def_lookup, "ly:output-def-lookup", LY_ASSERT_TYPE (ly_is_symbol, sym, 2); SCM answer = op->lookup_variable (sym); - if (answer == SCM_UNDEFINED) + if (SCM_UNBNDP (answer)) { - if (val == SCM_UNDEFINED) + if (SCM_UNBNDP (val)) val = SCM_EOL; answer = val; @@ -187,7 +187,7 @@ LY_DEFINE (ly_paper_fonts, "ly:paper-fonts", SCM tab2 = b->lookup_variable (ly_symbol2scm ("pango-fonts")); SCM alist1 = SCM_EOL; - if (scm_hash_table_p (tab1) == SCM_BOOL_T) + if (to_boolean (scm_hash_table_p (tab1))) { alist1 = scm_append (ly_alist_vals (ly_hash2alist (tab1))); diff --git a/lily/output-def.cc b/lily/output-def.cc index b6a83212c1..af407fb70a 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -114,7 +114,7 @@ SCM Output_def::lookup_variable (SCM sym) const { SCM var = ly_module_lookup (scope_, sym); - if (SCM_VARIABLEP (var) && SCM_VARIABLE_REF (var) != SCM_UNDEFINED) + if (SCM_VARIABLEP (var) && !SCM_UNBNDP (SCM_VARIABLE_REF (var))) return SCM_VARIABLE_REF (var); if (parent_) @@ -160,9 +160,9 @@ Output_def::normalize () ? c_variable ("inner-margin") : c_variable ("right-margin")); - if (scm_paper_width == SCM_UNDEFINED - || scm_left_margin_default == SCM_UNDEFINED - || scm_right_margin_default == SCM_UNDEFINED) + if (SCM_UNBNDP (scm_paper_width) + || SCM_UNBNDP (scm_left_margin_default) + || SCM_UNBNDP (scm_right_margin_default)) { programming_error ("called normalize () on paper with missing settings"); return; @@ -183,12 +183,12 @@ Output_def::normalize () if (twosided) binding_offset = robust_scm2double (c_variable ("binding-offset"), 0); - if (scm_line_width == SCM_UNDEFINED) + if (SCM_UNBNDP (scm_line_width)) { - left_margin = ((scm_left_margin == SCM_UNDEFINED) + left_margin = (SCM_UNBNDP (scm_left_margin) ? left_margin_default : scm_to_double (scm_left_margin)); - right_margin = ((scm_right_margin == SCM_UNDEFINED) + right_margin = (SCM_UNBNDP (scm_right_margin) ? right_margin_default : scm_to_double (scm_right_margin)) + binding_offset; line_width = paper_width - left_margin - right_margin; @@ -196,10 +196,10 @@ Output_def::normalize () else { line_width = scm_to_double (scm_line_width); - if (scm_left_margin == SCM_UNDEFINED) + if (SCM_UNBNDP (scm_left_margin)) { // Vertically center systems if only line-width is given - if (scm_right_margin == SCM_UNDEFINED) + if (SCM_UNBNDP (scm_right_margin)) { left_margin = (paper_width - line_width) / 2; right_margin = left_margin; @@ -213,7 +213,7 @@ Output_def::normalize () else { left_margin = scm_to_double (scm_left_margin); - right_margin = ((scm_right_margin == SCM_UNDEFINED) + right_margin = (SCM_UNBNDP (scm_right_margin) ? (paper_width - line_width - left_margin) : scm_to_double (scm_right_margin)) + binding_offset; } diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc index 768cb79cc2..b23cd4637b 100644 --- a/lily/page-breaking.cc +++ b/lily/page-breaking.cc @@ -594,7 +594,7 @@ Page_breaking::make_pages (vector<vsize> lines_per_page, SCM systems) SCM ret = SCM_EOL; bool reset_footnotes_on_new_page = to_boolean (book_->top_paper ()->c_variable ("reset-footnotes-on-new-page")); SCM label_page_table = book_->top_paper ()->c_variable ("label-page-table"); - if (label_page_table == SCM_UNDEFINED) + if (SCM_UNBNDP (label_page_table)) label_page_table = SCM_EOL; // Build a list of (systems configuration . footnote-count) triples. @@ -1133,7 +1133,7 @@ Page_breaking::min_page_count (vsize configuration, vsize first_page_num) if ((!too_few_lines (line_count) && (next_height > cur_page_height && cur_rod_height > 0)) || too_many_lines (next_line_count) - || (prev && prev->page_permission_ == ly_symbol2scm ("force"))) + || prev && scm_is_eq (prev->page_permission_, ly_symbol2scm ("force"))) { line_count = cur.compressed_nontitle_lines_count_; cur_rod_height = cur.full_height (); @@ -1332,7 +1332,7 @@ Page_breaking::space_systems_with_fixed_number_per_page (vsize configuration, system_count_on_this_page += cur_line.compressed_nontitle_lines_count_; line++; - if (cur_line.page_permission_ == ly_symbol2scm ("force")) + if (scm_is_eq (cur_line.page_permission_, ly_symbol2scm ("force"))) break; } @@ -1374,7 +1374,8 @@ Page_breaking::pack_systems_on_least_pages (vsize configuration, vsize first_pag if ((line > page_first_line) && (isinf (space.force_) || ((line > 0) - && (cached_line_details_[line - 1].page_permission_ == ly_symbol2scm ("force"))))) + && scm_is_eq (cached_line_details_[line - 1].page_permission_, + ly_symbol2scm ("force"))))) { res.systems_per_page_.push_back (line - page_first_line); res.force_.push_back (prev_force); @@ -1498,7 +1499,8 @@ Page_breaking::space_systems_on_2_pages (vsize configuration, vsize first_page_n /* if there is a forced break, this reduces to 2 1-page problems */ cache_line_details (configuration); for (vsize i = 0; i + 1 < cached_line_details_.size (); i++) - if (cached_line_details_[i].page_permission_ == ly_symbol2scm ("force")) + if (scm_is_eq (cached_line_details_[i].page_permission_, + ly_symbol2scm ("force"))) { vector<Line_details> lines1 (cached_line_details_.begin (), cached_line_details_.begin () + i + 1); vector<Line_details> lines2 (cached_line_details_.begin () + i + 1, cached_line_details_.end ()); diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc index 426299f0ad..6fe02c8bad 100644 --- a/lily/page-layout-problem.cc +++ b/lily/page-layout-problem.cc @@ -58,7 +58,7 @@ Page_layout_problem::get_footnote_grobs (SCM lines) else if (Prob *p = Prob::unsmob (scm_car (s))) { SCM stencils = p->get_property ("footnotes"); - if (stencils == SCM_EOL) + if (scm_is_null (stencils)) continue; for (SCM st = stencils; scm_is_pair (st); st = scm_cdr (st)) footnotes.push_back (0); diff --git a/lily/page-spacing.cc b/lily/page-spacing.cc index af7546f671..97c68a5e29 100644 --- a/lily/page-spacing.cc +++ b/lily/page-spacing.cc @@ -388,7 +388,8 @@ Page_spacer::calc_subproblem (vsize page, vsize line) } if (page_start > 0 - && lines_[page_start - 1].page_permission_ == ly_symbol2scm ("force")) + && scm_is_eq (lines_[page_start - 1].page_permission_, + ly_symbol2scm ("force"))) break; } return !isinf (cur.demerits_); diff --git a/lily/page-turn-engraver.cc b/lily/page-turn-engraver.cc index 22d26371a0..c658c0c94b 100644 --- a/lily/page-turn-engraver.cc +++ b/lily/page-turn-engraver.cc @@ -66,7 +66,7 @@ public: if (duration_[LEFT] < penalty.duration_[LEFT]) ret.push_back (Page_turn_event (duration_[LEFT], penalty.duration_[LEFT], permission_, penalty_)); - if (penalty.permission_ != SCM_EOL) + if (!scm_is_null (penalty.permission_)) ret.push_back (Page_turn_event (intersect[LEFT], intersect[RIGHT], permission_, new_pen)); if (penalty.duration_[RIGHT] < duration_[RIGHT]) @@ -229,9 +229,9 @@ Page_turn_engraver::stop_translation_timestep () for (; scm_is_pair (cs); cs = scm_cdr (cs)) { SCM command = scm_car (cs); - if (command == ly_symbol2scm ("start-repeat")) + if (scm_is_eq (command, ly_symbol2scm ("start-repeat"))) start = true; - else if (command == ly_symbol2scm ("end-repeat")) + else if (scm_is_eq (command, ly_symbol2scm ("end-repeat"))) end = true; } @@ -265,9 +265,10 @@ Page_turn_engraver::stop_translation_timestep () SCM Page_turn_engraver::max_permission (SCM perm1, SCM perm2) { - if (perm1 == SCM_EOL) + if (scm_is_null (perm1)) return perm2; - if (perm1 == ly_symbol2scm ("allow") && perm2 == ly_symbol2scm ("force")) + if (scm_is_eq (perm1, ly_symbol2scm ("allow")) + && scm_is_eq (perm2, ly_symbol2scm ("force"))) return perm2; return perm1; } diff --git a/lily/page-turn-page-breaking.cc b/lily/page-turn-page-breaking.cc index e8f43b6946..09545020c4 100644 --- a/lily/page-turn-page-breaking.cc +++ b/lily/page-turn-page-breaking.cc @@ -138,7 +138,8 @@ Page_turn_page_breaking::calc_subproblem (vsize ending_breakpoint) for (vsize start = end; start--;) { if (start < end - 1 - && breakpoint_property (start + 1, "page-turn-permission") == ly_symbol2scm ("force")) + && scm_is_eq (breakpoint_property (start + 1, "page-turn-permission"), + ly_symbol2scm ("force"))) break; if (start > 0 && best.demerits_ < state_[start - 1].demerits_) diff --git a/lily/pango-font.cc b/lily/pango-font.cc index 762e0842f3..fcdf958cef 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -440,8 +440,8 @@ Pango_font::text_stencil (Output_def * /* state */, variable that is bound to a *named* procedure, i.e. not a lambda expression. */ - if (utf8_string != SCM_BOOL_F - && scm_procedure_name (SCM_VARIABLE_REF (utf8_string)) != SCM_BOOL_F) + if (scm_is_true (utf8_string) + && scm_is_true (scm_procedure_name (SCM_VARIABLE_REF (utf8_string)))) has_utf8_string = true; } diff --git a/lily/pango-select.cc b/lily/pango-select.cc index a0cf0aaee3..8091e466ee 100644 --- a/lily/pango-select.cc +++ b/lily/pango-select.cc @@ -80,10 +80,10 @@ PangoStyle symbol_to_pango_style (SCM style) { PangoStyle pstyle = PANGO_STYLE_NORMAL; - if (style == ly_symbol2scm ("italic")) + if (scm_is_eq (style, ly_symbol2scm ("italic"))) pstyle = PANGO_STYLE_ITALIC; - else if (style == ly_symbol2scm ("oblique") - || style == ly_symbol2scm ("slanted")) + else if (scm_is_eq (style, ly_symbol2scm ("oblique")) + || scm_is_eq (style, ly_symbol2scm ("slanted"))) pstyle = PANGO_STYLE_OBLIQUE; return pstyle; @@ -93,7 +93,7 @@ PangoVariant symbol_to_pango_variant (SCM variant) { PangoVariant pvariant = PANGO_VARIANT_NORMAL; - if (variant == ly_symbol2scm ("caps")) + if (scm_is_eq (variant, ly_symbol2scm ("caps"))) pvariant = PANGO_VARIANT_SMALL_CAPS; return pvariant; } @@ -102,15 +102,15 @@ PangoWeight symbol_to_pango_weight (SCM weight) { PangoWeight pw = PANGO_WEIGHT_NORMAL; - if (weight == ly_symbol2scm ("bold")) + if (scm_is_eq (weight, ly_symbol2scm ("bold"))) pw = PANGO_WEIGHT_BOLD; - if (weight == ly_symbol2scm ("heavy")) + if (scm_is_eq (weight, ly_symbol2scm ("heavy"))) pw = PANGO_WEIGHT_HEAVY; - if (weight == ly_symbol2scm ("ultrabold")) + if (scm_is_eq (weight, ly_symbol2scm ("ultrabold"))) pw = PANGO_WEIGHT_ULTRABOLD; - if (weight == ly_symbol2scm ("light")) + if (scm_is_eq (weight, ly_symbol2scm ("light"))) pw = PANGO_WEIGHT_LIGHT; - if (weight == ly_symbol2scm ("ultralight")) + if (scm_is_eq (weight, ly_symbol2scm ("ultralight"))) pw = PANGO_WEIGHT_ULTRALIGHT; return pw; diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 382577146f..7dce3a9507 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -139,7 +139,7 @@ Paper_book::output_aux (SCM output_channel, } else { - if (scores_ == SCM_EOL) + if (scm_is_null (scores_)) return 0; paper_->set_variable (ly_symbol2scm ("first-page-number"), scm_from_long (*first_page_number)); @@ -165,7 +165,7 @@ Paper_book::output (SCM output_channel) with different line-widths) and why we need it at all. */ - if (paper_->c_variable ("line-width") == SCM_UNDEFINED) + if (SCM_UNBNDP (paper_->c_variable ("line-width"))) paper_->set_variable (ly_symbol2scm ("line-width"), paper_->c_variable ("paper-width")); @@ -188,7 +188,7 @@ Paper_book::output (SCM output_channel) SCM framework = ly_module_lookup (mod, ly_symbol2scm ("output-framework")); - if (framework != SCM_BOOL_F) + if (scm_is_true (framework)) { SCM func = scm_variable_ref (framework); scm_call_4 (func, @@ -207,7 +207,7 @@ Paper_book::output (SCM output_channel) SCM framework = ly_module_lookup (mod, ly_symbol2scm ("output-preview-framework")); - if (framework != SCM_BOOL_F) + if (scm_is_true (framework)) { SCM func = scm_variable_ref (framework); scm_call_4 (func, @@ -444,7 +444,7 @@ Paper_book::get_system_specs () if (ly_is_module (scm_car (s))) { header = scm_car (s); - if (header_0_ == SCM_EOL) + if (scm_is_null (header_0_)) header_0_ = header; } else if (Page_marker *page_marker = Page_marker::unsmob (scm_car (s))) @@ -560,7 +560,7 @@ Paper_book::get_system_specs () SCM Paper_book::systems () { - if (systems_ != SCM_BOOL_F) + if (scm_is_true (systems_)) return systems_; systems_ = SCM_EOL; @@ -610,9 +610,9 @@ Paper_book::systems () { SCM perm = ps->get_property ("page-break-permission"); Prob *next = Prob::unsmob (scm_cadr (s)); - if (perm == SCM_EOL) + if (scm_is_null (perm)) next->set_property ("penalty", scm_from_int (10001)); - else if (perm == ly_symbol2scm ("force")) + else if (scm_is_eq (perm, ly_symbol2scm ("force"))) next->set_property ("penalty", scm_from_int (-10001)); } } @@ -624,7 +624,7 @@ Paper_book::systems () SCM Paper_book::pages () { - if (SCM_BOOL_F != pages_) + if (scm_is_true (pages_)) return pages_; pages_ = SCM_EOL; @@ -653,7 +653,7 @@ Paper_book::pages () scm_call_2 (post_process, paper_->self_scm (), pages_); /* set systems_ from the pages */ - if (systems_ == SCM_BOOL_F) + if (scm_is_false (systems_)) { systems_ = SCM_EOL; for (SCM p = pages_; scm_is_pair (p); p = scm_cdr (p)) diff --git a/lily/paper-column-engraver.cc b/lily/paper-column-engraver.cc index 68c4882904..a2d046b9fb 100644 --- a/lily/paper-column-engraver.cc +++ b/lily/paper-column-engraver.cc @@ -259,7 +259,8 @@ Paper_column_engraver::stop_translation_timestep () for (vsize i = 0; i < break_events_.size (); i++) { SCM perm = break_events_[i]->get_property ("break-permission"); - if (perm == ly_symbol2scm ("force") || perm == ly_symbol2scm ("allow")) + if (scm_is_eq (perm, ly_symbol2scm ("force")) + || scm_is_eq (perm, ly_symbol2scm ("allow"))) warning (_ ("forced break was overridden by some other event, " "should you be using bar checks?")); } diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 4e1d68f5f8..155e37bdec 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -198,11 +198,11 @@ Paper_column::break_align_width (Grob *me, SCM align_syms) for (;!align && scm_is_pair (align_syms); align_syms = scm_cdr (align_syms)) { SCM align_sym = scm_car (align_syms); - if (align_sym == ly_symbol2scm ("staff-bar") - || align_sym == ly_symbol2scm ("break-alignment")) + if (scm_is_eq (align_sym, ly_symbol2scm ("staff-bar")) + || scm_is_eq (align_sym, ly_symbol2scm ("break-alignment"))) align = Pointer_group_interface::find_grob (me, ly_symbol2scm ("elements"), - (align_sym == ly_symbol2scm ("staff-bar") + (scm_is_eq (align_sym, ly_symbol2scm ("staff-bar")) ? Bar_line::non_empty_barline : Break_alignment_interface::has_interface)); else diff --git a/lily/paper-def.cc b/lily/paper-def.cc index f997c9905d..3d473f202d 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -34,7 +34,7 @@ SCM get_font_table (Output_def *def) { SCM font_table = def->lookup_variable (ly_symbol2scm ("scaled-fonts")); - if (scm_hash_table_p (font_table) != SCM_BOOL_T) + if (!to_boolean (scm_hash_table_p (font_table))) { font_table = scm_c_make_hash_table (11); def->set_variable (ly_symbol2scm ("scaled-fonts"), font_table); @@ -46,7 +46,7 @@ SCM get_pango_font_table (Output_def *def) { SCM font_table = def->lookup_variable (ly_symbol2scm ("pango-fonts")); - if (scm_hash_table_p (font_table) != SCM_BOOL_T) + if (!to_boolean (scm_hash_table_p (font_table))) { font_table = scm_c_make_hash_table (11); def->set_variable (ly_symbol2scm ("pango-fonts"), font_table); diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 5ba03e95c7..269e1e294c 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -118,7 +118,7 @@ Paper_outputter::output_stencil (Stencil stil) void Paper_outputter::close () { - if (scm_port_p (file_) == SCM_BOOL_T) + if (ly_is_port (file_)) { scm_close_port (file_); /* diff --git a/lily/paper-score.cc b/lily/paper-score.cc index af6622a9f3..0cecb79511 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -149,7 +149,7 @@ Paper_score::layout () const SCM Paper_score::get_paper_systems () { - if (paper_systems_ == SCM_BOOL_F) + if (scm_is_false (paper_systems_)) { vector<Column_x_positions> breaking = calc_breaking (); system_->break_into_pieces (breaking); diff --git a/lily/paper-system.cc b/lily/paper-system.cc index c0b70121fa..b67eb0123b 100644 --- a/lily/paper-system.cc +++ b/lily/paper-system.cc @@ -46,13 +46,13 @@ get_footnotes (SCM expr) SCM head = scm_car (expr); - if (head == ly_symbol2scm ("delay-stencil-evaluation")) + if (scm_is_eq (head, ly_symbol2scm ("delay-stencil-evaluation"))) { // we likely need to do something here...just don't know what... return SCM_EOL; } - if (head == ly_symbol2scm ("combine-stencil")) + if (scm_is_eq (head, ly_symbol2scm ("combine-stencil"))) { SCM out = SCM_EOL; SCM *tail = &out; @@ -60,7 +60,7 @@ get_footnotes (SCM expr) for (SCM x = scm_cdr (expr); scm_is_pair (x); x = scm_cdr (x)) { SCM footnote = get_footnotes (scm_car (x)); - if (SCM_EOL != footnote) + if (!scm_is_null (footnote)) { *tail = scm_cons (footnote, SCM_EOL); tail = SCM_CDRLOC (*tail); @@ -68,10 +68,10 @@ get_footnotes (SCM expr) } return scm_append (out); } - if (head == ly_symbol2scm ("translate-stencil")) + if (scm_is_eq (head, ly_symbol2scm ("translate-stencil"))) return get_footnotes (scm_caddr (expr)); - if (head == ly_symbol2scm ("footnote")) + if (scm_is_eq (head, ly_symbol2scm ("footnote"))) return scm_list_1 (scm_cdr (expr)); return SCM_EOL; diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index d18afa9d81..ec0c1572f0 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -92,7 +92,7 @@ internal_ly_eval_scm (Parse_start *ps) if (ps->safe_) { static SCM module = SCM_BOOL_F; - if (module == SCM_BOOL_F) + if (scm_is_false (module)) { SCM function = ly_lily_module_constant ("make-safe-lilypond-module"); module = scm_gc_protect_object (scm_call_0 (function)); diff --git a/lily/parser.yy b/lily/parser.yy index 2c324f5000..9630ff4837 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -451,11 +451,11 @@ toplevel_expression: } else if (Output_def * od = Output_def::unsmob ($1)) { SCM id = SCM_EOL; - if (od->c_variable ("is-paper") == SCM_BOOL_T) + if (to_boolean (od->c_variable ("is-paper"))) id = ly_symbol2scm ("$defaultpaper"); - else if (od->c_variable ("is-midi") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-midi"))) id = ly_symbol2scm ("$defaultmidi"); - else if (od->c_variable ("is-layout") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-layout"))) id = ly_symbol2scm ("$defaultlayout"); parser->lexer_->set_identifier (id, $1); @@ -466,11 +466,11 @@ toplevel_expression: SCM id = SCM_EOL; Output_def * od = Output_def::unsmob ($1); - if (od->c_variable ("is-paper") == SCM_BOOL_T) + if (to_boolean (od->c_variable ("is-paper"))) id = ly_symbol2scm ("$defaultpaper"); - else if (od->c_variable ("is-midi") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-midi"))) id = ly_symbol2scm ("$defaultmidi"); - else if (od->c_variable ("is-layout") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-layout"))) id = ly_symbol2scm ("$defaultlayout"); parser->lexer_->set_identifier (id, $1); @@ -835,11 +835,11 @@ book_body: } else if (Output_def *od = Output_def::unsmob ($2)) { SCM id = SCM_EOL; - if (od->c_variable ("is-paper") == SCM_BOOL_T) + if (to_boolean (od->c_variable ("is-paper"))) id = ly_symbol2scm ("$defaultpaper"); - else if (od->c_variable ("is-midi") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-midi"))) id = ly_symbol2scm ("$defaultmidi"); - else if (od->c_variable ("is-layout") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-layout"))) id = ly_symbol2scm ("$defaultlayout"); parser->lexer_->set_identifier (id, $2); @@ -916,11 +916,11 @@ bookpart_body: } else if (Output_def *od = Output_def::unsmob ($2)) { SCM id = SCM_EOL; - if (od->c_variable ("is-paper") == SCM_BOOL_T) + if (to_boolean (od->c_variable ("is-paper"))) id = ly_symbol2scm ("$defaultpaper"); - else if (od->c_variable ("is-midi") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-midi"))) id = ly_symbol2scm ("$defaultmidi"); - else if (od->c_variable ("is-layout") == SCM_BOOL_T) + else if (to_boolean (od->c_variable ("is-layout"))) id = ly_symbol2scm ("$defaultlayout"); parser->lexer_->set_identifier (id, $2); @@ -986,7 +986,7 @@ score_items: { Output_def *od = Output_def::unsmob ($2); if (od) { - if (od->lookup_variable (ly_symbol2scm ("is-paper")) == SCM_BOOL_T) + if (to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) { parser->parser_error (@2, _("\\paper cannot be used in \\score, use \\layout instead")); od = 0; @@ -1052,7 +1052,7 @@ paper_block: output_def { Output_def *od = Output_def::unsmob ($1); - if (od->lookup_variable (ly_symbol2scm ("is-paper")) != SCM_BOOL_T) + if (!to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) { parser->parser_error (@1, _ ("need \\paper for paper block")); $$ = get_paper (parser)->unprotect (); @@ -2227,7 +2227,7 @@ lyric_mode_music: mode_changed_music: mode_changing_head grouped_music_list { - if ($1 == ly_symbol2scm ("chords")) + if (scm_is_eq ($1, ly_symbol2scm ("chords"))) { $$ = MAKE_SYNTAX ("unrelativable-music", @$, $2); } @@ -2243,7 +2243,7 @@ mode_changed_music: if (ctxmod) mods = ctxmod->get_mods (); $$ = MAKE_SYNTAX ("context-specification", @$, $1, SCM_EOL, mods, SCM_BOOL_T, $3); - if ($1 == ly_symbol2scm ("ChordNames")) + if (scm_is_eq ($1, ly_symbol2scm ("ChordNames"))) { $$ = MAKE_SYNTAX ("unrelativable-music", @$, $$); } diff --git a/lily/part-combine-engraver.cc b/lily/part-combine-engraver.cc index 54ad1797a4..eaae218c1b 100644 --- a/lily/part-combine-engraver.cc +++ b/lily/part-combine-engraver.cc @@ -81,11 +81,11 @@ Part_combine_engraver::create_item (Stream_event *ev) { SCM what = scm_car (ev->get_property ("class")); SCM text = SCM_EOL; - if (what == ly_symbol2scm ("solo-one-event")) + if (scm_is_eq (what, ly_symbol2scm ("solo-one-event"))) text = get_property ("soloText"); - else if (what == ly_symbol2scm ("solo-two-event")) + else if (scm_is_eq (what, ly_symbol2scm ("solo-two-event"))) text = get_property ("soloIIText"); - else if (what == ly_symbol2scm ("unisono-event")) + else if (scm_is_eq (what, ly_symbol2scm ("unisono-event"))) text = get_property ("aDueText"); if (Text_interface::is_markup (text)) diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc index 2428d4a70f..d1a8f019f3 100644 --- a/lily/part-combine-iterator.cc +++ b/lily/part-combine-iterator.cc @@ -490,30 +490,30 @@ Part_combine_iterator::process (Moment m) SCM tag = scm_cdar (split_list_); - if (tag == ly_symbol2scm ("chords")) + if (scm_is_eq (tag, ly_symbol2scm ("chords"))) chords_together (); - else if (tag == ly_symbol2scm ("apart") - || tag == ly_symbol2scm ("apart-silence") - || tag == ly_symbol2scm ("apart-spanner")) - apart (tag == ly_symbol2scm ("apart-silence")); - else if (tag == ly_symbol2scm ("unisono")) + else if (scm_is_eq (tag, ly_symbol2scm ("apart")) + || scm_is_eq (tag, ly_symbol2scm ("apart-silence")) + || scm_is_eq (tag, ly_symbol2scm ("apart-spanner"))) + apart (scm_is_eq (tag, ly_symbol2scm ("apart-silence"))); + else if (scm_is_eq (tag, ly_symbol2scm ("unisono"))) { // Continue to use the most recently used part because we might have // killed mmrests in the other part. unisono (false, (last_playing_ == 2) ? 2 : 1); } - else if (tag == ly_symbol2scm ("unisilence")) + else if (scm_is_eq (tag, ly_symbol2scm ("unisilence"))) { // as for unisono unisono (true, (last_playing_ == 2) ? 2 : 1); } - else if (tag == ly_symbol2scm ("silence1")) + else if (scm_is_eq (tag, ly_symbol2scm ("silence1"))) unisono (true, 1); - else if (tag == ly_symbol2scm ("silence2")) + else if (scm_is_eq (tag, ly_symbol2scm ("silence2"))) unisono (true, 2); - else if (tag == ly_symbol2scm ("solo1")) + else if (scm_is_eq (tag, ly_symbol2scm ("solo1"))) solo1 (); - else if (tag == ly_symbol2scm ("solo2")) + else if (scm_is_eq (tag, ly_symbol2scm ("solo2"))) solo2 (); else if (scm_is_symbol (tag)) { diff --git a/lily/percent-repeat-engraver.cc b/lily/percent-repeat-engraver.cc index 004548b2e9..03bd86b9cf 100644 --- a/lily/percent-repeat-engraver.cc +++ b/lily/percent-repeat-engraver.cc @@ -122,7 +122,7 @@ Percent_repeat_engraver::process_music () percent_->set_bound (LEFT, col); SCM count = percent_event_->get_property ("repeat-count"); - if (count != SCM_EOL && to_boolean (get_property ("countPercentRepeats")) + if (!scm_is_null (count) && to_boolean (get_property ("countPercentRepeats")) && check_repeat_count_visibility (context (), count)) { percent_counter_ = make_spanner ("PercentRepeatCounter", diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 546351a0b9..1cad3323be 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -251,11 +251,11 @@ Piano_pedal_engraver::process_music () SCM style = get_property (p->type_->style_sym_); - bool mixed = style == ly_symbol2scm ("mixed"); + bool mixed = scm_is_eq (style, ly_symbol2scm ("mixed")); bool bracket = (mixed - || style == ly_symbol2scm ("bracket")); - bool text = (style == ly_symbol2scm ("text") - || mixed); + || scm_is_eq (style, ly_symbol2scm ("bracket"))); + bool text = (mixed + || scm_is_eq (style, ly_symbol2scm ("text"))); if (text && !p->item_) create_text_grobs (p, mixed); diff --git a/lily/pitched-trill-engraver.cc b/lily/pitched-trill-engraver.cc index b30d984edc..4f4fad2325 100644 --- a/lily/pitched-trill-engraver.cc +++ b/lily/pitched-trill-engraver.cc @@ -106,7 +106,7 @@ Pitched_trill_engraver::make_trill (Stream_event *ev) int bn = measure_number (context ()); SCM handle = scm_assoc (key, keysig); - if (handle != SCM_BOOL_F) + if (scm_is_true (handle)) { bool same_bar = (bn == robust_scm2int (scm_caddr (handle), 0)); bool same_alt @@ -116,9 +116,9 @@ Pitched_trill_engraver::make_trill (Stream_event *ev) handle = SCM_BOOL_F; } - bool print_acc - = (handle == SCM_BOOL_F) || p->get_alteration () == Rational (0) - || (ev->get_property ("force-accidental") == SCM_BOOL_T); + bool print_acc = scm_is_false (handle) + || p->get_alteration () == Rational (0) + || to_boolean (ev->get_property ("force-accidental")); if (trill_head_) { diff --git a/lily/prob-scheme.cc b/lily/prob-scheme.cc index a57cb7aa9f..82e4fbdca3 100644 --- a/lily/prob-scheme.cc +++ b/lily/prob-scheme.cc @@ -51,11 +51,11 @@ LY_DEFINE (ly_prob_property, "ly:prob-property", Prob *ps = Prob::unsmob (prob); LY_ASSERT_TYPE (ly_is_symbol, sym, 2); - if (val == SCM_UNDEFINED) + if (SCM_UNBNDP (val)) val = SCM_EOL; SCM retval = ps->get_property (sym); - if (retval == SCM_EOL) + if (scm_is_null (retval)) return val; else return retval; diff --git a/lily/prob.cc b/lily/prob.cc index 52ce8b6821..37dad6246b 100644 --- a/lily/prob.cc +++ b/lily/prob.cc @@ -61,15 +61,14 @@ Prob::equal_p (SCM sa, SCM sb) { SCM aval = scm_cdar (aprop); SCM bval = scm_cdar (bprop); - if (scm_caar (aprop) != scm_caar (bprop) + if (!scm_is_eq (scm_caar (aprop), scm_caar (bprop)) || (!(Input::is_smob (aval) && Input::is_smob (bval)) - && - !to_boolean (scm_equal_p (aval, bval)))) + && !ly_is_equal (aval, bval))) return SCM_BOOL_F; } /* is one list shorter? */ - if (aprop != SCM_EOL || bprop != SCM_EOL) + if (!scm_is_null (aprop) || !scm_is_null (bprop)) return SCM_BOOL_F; } @@ -151,11 +150,11 @@ Prob::internal_get_property (SCM sym) const TODO: type checking */ SCM s = scm_sloppy_assq (sym, mutable_property_alist_); - if (s != SCM_BOOL_F) + if (scm_is_true (s)) return scm_cdr (s); s = scm_sloppy_assq (sym, immutable_property_alist_); - return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s); + return scm_is_false (s) ? SCM_EOL : scm_cdr (s); } /* We don't (yet) instrument probs */ diff --git a/lily/profile.cc b/lily/profile.cc index dd38f0425b..025bea809b 100644 --- a/lily/profile.cc +++ b/lily/profile.cc @@ -31,13 +31,13 @@ LY_DEFINE (ly_property_lookup_stats, "ly:property-lookup-stats", " @var{sym}. Choices are @code{prob}, @code{grob}, and" " @code{context}.") { - if (sym == ly_symbol2scm ("context")) + if (scm_is_eq (sym, ly_symbol2scm ("context"))) return context_property_lookup_table ? context_property_lookup_table : scm_c_make_hash_table (1); - if (sym == ly_symbol2scm ("prob")) + if (scm_is_eq (sym, ly_symbol2scm ("prob"))) return prob_property_lookup_table ? prob_property_lookup_table : scm_c_make_hash_table (1); - if (sym == ly_symbol2scm ("grob")) + if (scm_is_eq (sym, ly_symbol2scm ("grob"))) return grob_property_lookup_table ? grob_property_lookup_table : scm_c_make_hash_table (1); return scm_c_make_hash_table (1); @@ -53,7 +53,7 @@ note_property_access (SCM *table, SCM sym) *table = scm_permanent_object (scm_c_make_hash_table (259)); SCM hashhandle = scm_hashq_get_handle (*table, sym); - if (hashhandle == SCM_BOOL_F) + if (scm_is_false (hashhandle)) { scm_hashq_set_x (*table, sym, scm_from_int (0)); hashhandle = scm_hashq_get_handle (*table, sym); diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc index 769c97064f..80cd0e4e2f 100644 --- a/lily/program-option-scheme.cc +++ b/lily/program-option-scheme.cc @@ -208,7 +208,7 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), { LY_ASSERT_TYPE (ly_is_symbol, var, 1); - if (val == SCM_UNDEFINED) + if (SCM_UNBNDP (val)) val = SCM_BOOL_T; string varstr = robust_symbol2string (var, ""); @@ -219,7 +219,7 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), } SCM handle = scm_hashq_get_handle (option_hash, var); - if (handle == SCM_BOOL_F) + if (scm_is_false (handle)) warning (_f ("no such internal option: %s", varstr.c_str ())); internal_set_option (var, val); diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index 66f0590893..c68e223456 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -71,7 +71,7 @@ Quote_iterator::accept_music_type (Stream_event *ev, bool is_cue) const // for cue notes if quotedCueEventTypes is not set) use quotedEventTypes if (is_cue) accept = get_outlet ()->get_property ("quotedCueEventTypes"); - if (accept == SCM_EOL) + if (scm_is_null (accept)) accept = get_outlet ()->get_property ("quotedEventTypes"); for (; scm_is_pair (accept); accept = scm_cdr (accept)) diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index a76484e086..67477b1f01 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -85,13 +85,14 @@ Repeat_acknowledge_engraver::process_music () while (scm_is_pair (cs)) { SCM command = scm_car (cs); - if (command == ly_symbol2scm ("start-repeat")) + if (scm_is_eq (command, ly_symbol2scm ("start-repeat"))) start = true; - else if (command == ly_symbol2scm ("end-repeat")) + else if (scm_is_eq (command, ly_symbol2scm ("end-repeat"))) end = true; - else if (command == ly_symbol2scm ("segno-display")) + else if (scm_is_eq (command, ly_symbol2scm ("segno-display"))) segno = true; - else if (scm_is_pair (command) && scm_car (command) == ly_symbol2scm ("volta")) + else if (scm_is_pair (command) + && scm_is_eq (scm_car (command), ly_symbol2scm ("volta"))) volta_found = true; cs = scm_cdr (cs); } diff --git a/lily/score-performer.cc b/lily/score-performer.cc index 9c3b82267d..7546cbd630 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -119,7 +119,7 @@ void Score_performer::finish (SCM) { SCM channel_mapping = context ()->get_property ("midiChannelMapping"); - bool use_ports = channel_mapping == ly_symbol2scm ("voice"); + bool use_ports = scm_is_eq (channel_mapping, ly_symbol2scm ("voice")); performance_->ports_ = use_ports; recurse_over_translators (context (), &Translator::finalize, diff --git a/lily/score-scheme.cc b/lily/score-scheme.cc index ed930d5fa0..c8262dc7df 100644 --- a/lily/score-scheme.cc +++ b/lily/score-scheme.cc @@ -124,7 +124,7 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", /* UGR, FIXME, these are default \layout blocks once again. They suck. */ for (vsize i = 0; !score_def && i < sc->defs_.size (); i++) - if (sc->defs_[i]->c_variable ("is-layout") == SCM_BOOL_T) + if (to_boolean (sc->defs_[i]->c_variable ("is-layout"))) score_def = sc->defs_[i]; if (!score_def) diff --git a/lily/score.cc b/lily/score.cc index 3a1232d2a2..5ce7e3ba95 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -117,7 +117,7 @@ Score::book_rendering (Output_def *layoutbook, Real scale = 1.0; - if (layoutbook && layoutbook->c_variable ("is-paper") == SCM_BOOL_T) + if (layoutbook && to_boolean (layoutbook->c_variable ("is-paper"))) scale = scm_to_double (layoutbook->c_variable ("output-scale")); SCM outputs = SCM_EOL; @@ -129,7 +129,7 @@ Score::book_rendering (Output_def *layoutbook, Output_def *def = outdef_count ? defs_[i] : default_def; SCM scaled = def->self_scm (); - if (def->c_variable ("is-layout") == SCM_BOOL_T) + if (to_boolean (def->c_variable ("is-layout"))) { def = scale_output_def (def, scale); def->parent_ = layoutbook; diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index f2ef9697a1..62c3de482c 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -90,7 +90,7 @@ Script_engraver::listen_articulation (Stream_event *ev) void copy_property (Grob *g, SCM sym, SCM alist) { - if (g->get_property (sym) == SCM_EOL) + if (scm_is_null (g->get_property (sym))) { SCM entry = scm_assoc (sym, alist); if (scm_is_pair (entry)) @@ -109,7 +109,7 @@ make_script_from_event (Grob *p, Context *tg, SCM alist = tg->get_property ("scriptDefinitions"); SCM art = scm_assoc (art_type, alist); - if (art == SCM_BOOL_F) + if (scm_is_false (art)) { /* FIXME: */ warning (_ ("do not know how to interpret articulation:")); @@ -132,7 +132,7 @@ make_script_from_event (Grob *p, Context *tg, SCM val = scm_cdar (s); - if (sym == ly_symbol2scm ("script-priority")) + if (scm_is_eq (sym, ly_symbol2scm ("script-priority"))) { priority_found = true; /* Make sure they're in order of user input by adding index i. @@ -144,8 +144,8 @@ make_script_from_event (Grob *p, Context *tg, } SCM preset = p->get_property_data (sym); - if (val == SCM_EOL - || scm_call_1 (type, preset) == SCM_BOOL_F) + if (scm_is_null (val) + || scm_is_false (scm_call_1 (type, preset))) p->set_property (sym, val); } diff --git a/lily/script-interface.cc b/lily/script-interface.cc index c4a136b06f..c9442fe9ae 100644 --- a/lily/script-interface.cc +++ b/lily/script-interface.cc @@ -36,7 +36,7 @@ Script_interface::get_stencil (Grob *me, Direction d) assert (scm_is_pair (s)); SCM key = scm_car (s); - if (key == ly_symbol2scm ("feta")) + if (scm_is_eq (key, ly_symbol2scm ("feta"))) { SCM name_entry = scm_cdr (s); SCM str = ((scm_is_pair (name_entry)) ? index_get_cell (name_entry, d) @@ -110,8 +110,8 @@ Script_interface::calc_cross_staff (SCM smob) Grob *slur = Grob::unsmob (me->get_object ("slur")); SCM avoid_slur = me->get_property ("avoid-slur"); if (slur && to_boolean (slur->get_property ("cross-staff")) - && (avoid_slur == ly_symbol2scm ("outside") - || avoid_slur == ly_symbol2scm ("around"))) + && (scm_is_eq (avoid_slur, ly_symbol2scm ("outside")) + || scm_is_eq (avoid_slur, ly_symbol2scm ("around")))) return SCM_BOOL_T; return SCM_BOOL_F; diff --git a/lily/self-alignment-interface.cc b/lily/self-alignment-interface.cc index bdb2854fd4..81a21075ee 100644 --- a/lily/self-alignment-interface.cc +++ b/lily/self-alignment-interface.cc @@ -129,7 +129,7 @@ Self_alignment_interface::aligned_on_parent (Grob *me, Axis a) ? me->get_property ("parent-alignment-X") : me->get_property ("parent-alignment-Y"); - if (par_align == SCM_EOL) + if (scm_is_null (par_align)) par_align = self_align; Real x = 0.0; diff --git a/lily/simple-closure.cc b/lily/simple-closure.cc index e99c8570b7..b62649f06d 100644 --- a/lily/simple-closure.cc +++ b/lily/simple-closure.cc @@ -32,7 +32,7 @@ evaluate_args (SCM delayed_argument, SCM args, bool pure, int start, int end) *tail = scm_cons (evaluate_with_simple_closure (delayed_argument, scm_car (s), pure, start, end), SCM_EOL); - if (scm_car (*tail) == SCM_UNSPECIFIED) + if (scm_is_eq (scm_car (*tail), SCM_UNSPECIFIED)) return SCM_UNSPECIFIED; tail = SCM_CDRLOC (*tail); } @@ -56,7 +56,7 @@ evaluate_with_simple_closure (SCM delayed_argument, SCM args = scm_cons (delayed_argument, evaluate_args (delayed_argument, scm_cdr (inside), pure, start, end)); - if (scm_cdr (args) == SCM_UNSPECIFIED) + if (scm_is_eq (scm_cdr (args), SCM_UNSPECIFIED)) return SCM_UNSPECIFIED; if (pure) return call_pure_function (proc, args, start, end); @@ -64,7 +64,7 @@ evaluate_with_simple_closure (SCM delayed_argument, } else if (!scm_is_pair (expr)) return expr; - else if (scm_car (expr) == ly_symbol2scm ("quote")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("quote"))) return scm_cadr (expr); else if (Unpure_pure_container::is_smob (scm_car (expr)) || ly_is_procedure (scm_car (expr))) @@ -73,7 +73,7 @@ evaluate_with_simple_closure (SCM delayed_argument, ? Unpure_pure_container::unsmob (scm_car (expr))->unpure_part () : scm_car (expr); SCM args = evaluate_args (delayed_argument, scm_cdr (expr), pure, start, end); - if (args == SCM_UNSPECIFIED) + if (scm_is_eq (args, SCM_UNSPECIFIED)) return SCM_UNSPECIFIED; if (pure) return call_pure_function (proc, args, start, end); diff --git a/lily/simple-spacer-scheme.cc b/lily/simple-spacer-scheme.cc index cc09da1021..7c1c866c61 100644 --- a/lily/simple-spacer-scheme.cc +++ b/lily/simple-spacer-scheme.cc @@ -48,7 +48,7 @@ LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods"); LY_ASSERT_TYPE (scm_is_number, length, 3); - bool is_ragged = ragged == SCM_BOOL_T; + bool is_ragged = to_boolean (ragged); Simple_spacer spacer; for (SCM s = springs; scm_is_pair (s); s = scm_cdr (s)) { diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index d17fa1ed73..ada16593aa 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -528,7 +528,7 @@ get_line_configuration (vector<Grob *> const &columns, for (vsize i = 1; i + 1 < ret.cols_.size (); i++) { SCM p = ret.cols_[i]->get_property ("line-break-permission"); - if (p == ly_symbol2scm ("force")) + if (scm_is_eq (p, ly_symbol2scm ("force"))) ret.satisfies_constraints_ = false; } diff --git a/lily/skyline.cc b/lily/skyline.cc index 66cca3fd53..42a028fe0a 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -811,7 +811,7 @@ Skyline::get_touching_point (SCM skyline_scm, SCM other_skyline_scm, SCM horizon LY_ASSERT_SMOB (Skyline, other_skyline_scm, 1); Real horizon_padding = 0; - if (horizon_padding_scm != SCM_UNDEFINED) + if (!SCM_UNBNDP (horizon_padding_scm)) { LY_ASSERT_TYPE (scm_is_number, horizon_padding_scm, 3); horizon_padding = scm_to_double (horizon_padding_scm); @@ -829,7 +829,7 @@ Skyline::get_distance (SCM skyline_scm, SCM other_skyline_scm, SCM horizon_paddi LY_ASSERT_SMOB (Skyline, other_skyline_scm, 1); Real horizon_padding = 0; - if (horizon_padding_scm != SCM_UNDEFINED) + if (!SCM_UNBNDP (horizon_padding_scm)) { LY_ASSERT_TYPE (scm_is_number, horizon_padding_scm, 3); horizon_padding = scm_to_double (horizon_padding_scm); diff --git a/lily/slur-configuration.cc b/lily/slur-configuration.cc index 3383c1f3b0..8e1db97d84 100644 --- a/lily/slur-configuration.cc +++ b/lily/slur-configuration.cc @@ -412,14 +412,14 @@ Slur_configuration::score_extra_encompass (Slur_score_state const &state) } Real dist = 0.0; - if (info.type_ == ly_symbol2scm ("around")) + if (scm_is_eq (info.type_, ly_symbol2scm ("around"))) dist = info.extents_[Y_AXIS].distance (y); /* Have to score too: the curve enumeration is limited in its shape, and may produce curves which collide anyway. */ - else if (info.type_ == ly_symbol2scm ("inside")) + else if (scm_is_eq (info.type_, ly_symbol2scm ("inside"))) dist = state.dir_ * (y - info.extents_[Y_AXIS][state.dir_]); else programming_error ("unknown avoidance type"); diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 7271cc7a7c..85e917f96f 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -281,7 +281,8 @@ Slur_score_state::fill (Grob *me) end_ys[RIGHT], end_ys[LEFT]); Real encompass_place = extra_encompass_infos_[i].extents_[Y_AXIS][dir_]; - if (extra_encompass_infos_[i].type_ == ly_symbol2scm ("inside") + if (scm_is_eq (extra_encompass_infos_[i].type_, + ly_symbol2scm ("inside")) && minmax (dir_, encompass_place, y_place) == encompass_place && (!extra_encompass_infos_[i].grob_->internal_has_interface (ly_symbol2scm ("key-signature-interface")) && !Clef::has_interface (extra_encompass_infos_[i].grob_) @@ -638,7 +639,8 @@ Slur_score_state::generate_avoid_offsets () const z[Y_AXIS] += dir_ * parameters_.free_slur_distance_; avoid.push_back (z); } - else if (extra_encompasses[i]->get_property ("avoid-slur") == ly_symbol2scm ("inside")) + else if (scm_is_eq (extra_encompasses[i]->get_property ("avoid-slur"), + ly_symbol2scm ("inside"))) { Grob *g = extra_encompasses [i]; Interval xe = g->extent (common_[X_AXIS], X_AXIS); diff --git a/lily/slur.cc b/lily/slur.cc index 22c24b76b2..0f3f7162a7 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -211,7 +211,8 @@ Slur::replace_breakable_encompass_objects (Grob *me) /* if we encompass a separation-item that spans multiple staves, we filter out the grobs that don't belong to our staff */ if (me->common_refpoint (breakables[j], Y_AXIS) == me->get_parent (Y_AXIS) - && breakables[j]->get_property ("avoid-slur") == ly_symbol2scm ("inside")) + && scm_is_eq (breakables[j]->get_property ("avoid-slur"), + ly_symbol2scm ("inside"))) new_encompasses.push_back (breakables[j]); } else @@ -264,7 +265,8 @@ Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offs return offset_scm; SCM avoid = script->get_property ("avoid-slur"); - if (avoid != ly_symbol2scm ("outside") && avoid != ly_symbol2scm ("around")) + if (!scm_is_eq (avoid, ly_symbol2scm ("outside")) + && !scm_is_eq (avoid, ly_symbol2scm ("around"))) return offset_scm; Real offset = robust_scm2double (offset_scm, 0.0); @@ -283,8 +285,8 @@ Slur::outside_slur_callback (SCM grob, SCM offset_scm) return offset_scm; SCM avoid = script->get_property ("avoid-slur"); - if (avoid != ly_symbol2scm ("outside") - && avoid != ly_symbol2scm ("around")) + if (!scm_is_eq (avoid, ly_symbol2scm ("outside")) + && !scm_is_eq (avoid, ly_symbol2scm ("around"))) return offset_scm; Direction dir = get_grob_direction (script); @@ -328,7 +330,7 @@ Slur::outside_slur_callback (SCM grob, SCM offset_scm) Interval exts[] = {xext, yext}; bool do_shift = false; Real EPS = 1.0e-5; - if (avoid == ly_symbol2scm ("outside")) + if (scm_is_eq (avoid, ly_symbol2scm ("outside"))) { for (LEFT_and_RIGHT (d)) { @@ -408,7 +410,7 @@ Slur::auxiliary_acknowledge_extra_object (Grob_info const &info, slur = slurs[0]; if (Tie::has_interface (e) - || avoid == ly_symbol2scm ("inside")) + || scm_is_eq (avoid, ly_symbol2scm ("inside"))) { for (vsize i = slurs.size (); i--;) add_extra_encompass (slurs[i], e); @@ -417,8 +419,8 @@ Slur::auxiliary_acknowledge_extra_object (Grob_info const &info, if (slur) e->set_object ("slur", slur->self_scm ()); } - else if (avoid == ly_symbol2scm ("outside") - || avoid == ly_symbol2scm ("around")) + else if (scm_is_eq (avoid, ly_symbol2scm ("outside")) + || scm_is_eq (avoid, ly_symbol2scm ("around"))) { if (slur) { @@ -430,7 +432,7 @@ Slur::auxiliary_acknowledge_extra_object (Grob_info const &info, e->set_object ("slur", slur->self_scm ()); } } - else if (avoid != ly_symbol2scm ("ignore")) + else if (!scm_is_eq (avoid, ly_symbol2scm ("ignore"))) e->warning (_f ("Ignoring grob for slur: %s. avoid-slur not set?", e->name ().c_str ())); } @@ -445,7 +447,7 @@ MAKE_SCHEME_CALLBACK (Slur, outside_slur_cross_staff, 2) SCM Slur::outside_slur_cross_staff (SCM smob, SCM previous) { - if (previous == SCM_BOOL_T) + if (to_boolean (previous)) return previous; Grob *me = Grob::unsmob (smob); diff --git a/lily/smobs.cc b/lily/smobs.cc index d1bea956d4..8b3c8a9014 100644 --- a/lily/smobs.cc +++ b/lily/smobs.cc @@ -46,7 +46,7 @@ protect_smob (SCM smob, SCM *prot_cons) { #if 0 SCM s = scm_cdr (smob_protection_list); - while (scm_is_pair (s) && scm_car (s) == SCM_BOOL_F) + while (scm_is_pair (s) && scm_is_false (scm_car (s)) { s = scm_cdr (s); } @@ -69,13 +69,13 @@ unprotect_smob (SCM smob, SCM *prot_cons) #else SCM next = scm_cdr (*prot_cons); - if (next == SCM_EOL) + if (scm_is_null (next))) scm_set_car_x (*prot_cons, SCM_BOOL_F); else { scm_set_car_x (*prot_cons, SCM_BOOL_F); while (scm_is_pair (next) - && scm_car (next) == SCM_BOOL_F) + && scm_is_false (scm_car (next))) next = scm_cdr (next); diff --git a/lily/spaceable-grob.cc b/lily/spaceable-grob.cc index c3c608cc0b..6a9183486d 100644 --- a/lily/spaceable-grob.cc +++ b/lily/spaceable-grob.cc @@ -51,7 +51,7 @@ Spaceable_grob::add_rod (Grob *me, Grob *p, Real d) for (SCM s = mins; scm_is_pair (s); s = scm_cdr (s)) { SCM dist = scm_car (s); - if (scm_car (dist) == p->self_scm ()) + if (scm_is_eq (scm_car (dist), p->self_scm ())) { scm_set_cdr_x (dist, scm_max (scm_cdr (dist), newdist)); diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index e7e0a7f3f7..87dd3ff197 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -115,7 +115,8 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) { Grob *h = gelts[j]; - if (h && h->get_property ("break-align-symbol") == ly_symbol2scm ("staff-bar")) + if (h && scm_is_eq (h->get_property ("break-align-symbol"), + ly_symbol2scm ("staff-bar"))) { extract_grob_set (h, "elements", helts); for (vsize k = helts.size (); k--;) diff --git a/lily/spanner.cc b/lily/spanner.cc index 8475231321..6232b8e7d3 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -533,7 +533,7 @@ Spanner::get_cached_pure_property (SCM sym, int start, int end) // The pure property cache is indexed by (name start . end), where name is // a symbol, and start and end are numbers referring to the starting and // ending column ranks of the current line. - if (scm_hash_table_p (pure_property_cache_) == SCM_BOOL_F) + if (scm_is_false (scm_hash_table_p (pure_property_cache_))) return SCM_UNDEFINED; SCM key = scm_cons (sym, scm_cons (scm_from_int (start), scm_from_int (end))); @@ -543,7 +543,7 @@ Spanner::get_cached_pure_property (SCM sym, int start, int end) void Spanner::cache_pure_property (SCM sym, int start, int end, SCM val) { - if (scm_hash_table_p (pure_property_cache_) == SCM_BOOL_F) + if (scm_is_false (scm_hash_table_p (pure_property_cache_))) pure_property_cache_ = scm_c_make_hash_table (17); SCM key = scm_cons (sym, scm_cons (scm_from_int (start), scm_from_int (end))); diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 7235c0486d..f635130b70 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -161,7 +161,7 @@ Audio_staff * Staff_performer::get_audio_staff (const string &voice) { SCM channel_mapping = get_property ("midiChannelMapping"); - if (channel_mapping != ly_symbol2scm ("instrument") + if (!scm_is_eq (channel_mapping, ly_symbol2scm ("instrument")) && staff_map_.size ()) return staff_map_.begin ()->second; @@ -201,7 +201,7 @@ Staff_performer::set_instrument (int channel, const string &voice) audio_staff->add_audio_item (instrument_); SCM proc = ly_lily_module_constant ("percussion?"); SCM drums = scm_call_1 (proc, ly_symbol2scm (instrument_string_.c_str ())); - audio_staff->percussion_ = (drums == SCM_BOOL_T); + audio_staff->percussion_ = to_boolean (drums); } void @@ -272,11 +272,11 @@ Staff_performer::get_channel (const string &instrument) { SCM channel_mapping = get_property ("midiChannelMapping"); map<string, int> &channel_map - = (channel_mapping != ly_symbol2scm ("instrument")) + = (!scm_is_eq (channel_mapping, ly_symbol2scm ("instrument"))) ? channel_map_ : static_channel_map_; - if (channel_mapping == ly_symbol2scm ("staff") + if (scm_is_eq (channel_mapping, ly_symbol2scm ("staff")) && channel_ >= 0) return channel_; @@ -284,7 +284,7 @@ Staff_performer::get_channel (const string &instrument) if (i != channel_map.end ()) return i->second; - int channel = (channel_mapping == ly_symbol2scm ("staff")) + int channel = (scm_is_eq (channel_mapping, ly_symbol2scm ("staff"))) ? channel_count_++ : channel_map.size (); @@ -319,13 +319,13 @@ Staff_performer::acknowledge_audio_element (Audio_element_info inf) voice = c->id_string (); SCM channel_mapping = get_property ("midiChannelMapping"); string str = new_instrument_string (); - if (channel_mapping != ly_symbol2scm ("instrument")) + if (!scm_is_eq (channel_mapping, ly_symbol2scm ("instrument"))) channel_ = get_channel (voice); else if (channel_ < 0 && str.empty ()) channel_ = get_channel (str); if (str.length ()) { - if (channel_mapping != ly_symbol2scm ("voice")) + if (!scm_is_eq (channel_mapping, ly_symbol2scm ("voice"))) channel_ = get_channel (str); set_instrument (channel_, voice); set_instrument_name (voice); diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc index 99052146bb..c414268f26 100644 --- a/lily/staff-spacing.cc +++ b/lily/staff-spacing.cc @@ -165,21 +165,21 @@ Staff_spacing::get_spacing (Grob *me, Grob *right_col, Real situational_space) Real fixed = last_ext[RIGHT]; Real ideal = fixed + 1.0; - if (type == ly_symbol2scm ("fixed-space")) + if (scm_is_eq (type, ly_symbol2scm ("fixed-space"))) { fixed += distance; ideal = fixed; } - else if (type == ly_symbol2scm ("extra-space")) + else if (scm_is_eq (type, ly_symbol2scm ("extra-space"))) ideal = fixed + distance; - else if (type == ly_symbol2scm ("semi-fixed-space")) + else if (scm_is_eq (type, ly_symbol2scm ("semi-fixed-space"))) { fixed += distance / 2; ideal = fixed + distance / 2; } - else if (type == ly_symbol2scm ("minimum-space")) + else if (scm_is_eq (type, ly_symbol2scm ("minimum-space"))) ideal = last_ext[LEFT] + max (last_ext.length (), distance); - else if (type == ly_symbol2scm ("minimum-fixed-space")) + else if (scm_is_eq (type, ly_symbol2scm ("minimum-fixed-space"))) { fixed = last_ext[LEFT] + max (last_ext.length (), distance); ideal = fixed; diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 9021642785..e861d26566 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -116,7 +116,7 @@ Stem_tremolo::raw_stencil (Grob *me, Real slope, Direction dir) thick *= ss; Stencil a; - if (style == ly_symbol2scm ("rectangle")) + if (scm_is_eq (style, ly_symbol2scm ("rectangle"))) a = Lookup::rotated_box (slope, width, thick, blot); else a = Lookup::beam (slope, width, thick, blot); diff --git a/lily/stem.cc b/lily/stem.cc index f21e0de6b5..6b4b95b015 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -533,7 +533,8 @@ Stem::calc_positioning_done (SCM smob) bool is_harmonic_centered = false; for (vsize i = 0; i < heads.size (); i++) is_harmonic_centered = is_harmonic_centered - || heads[i]->get_property ("style") == ly_symbol2scm ("harmonic"); + || scm_is_eq (heads[i]->get_property ("style"), + ly_symbol2scm ("harmonic")); is_harmonic_centered = is_harmonic_centered && is_invisible (me); Real w = hed->extent (hed, X_AXIS)[dir]; diff --git a/lily/stencil-expression.cc b/lily/stencil-expression.cc index c156d0aa9f..06aabb992f 100644 --- a/lily/stencil-expression.cc +++ b/lily/stencil-expression.cc @@ -33,8 +33,7 @@ void register_stencil_head (SCM symbol) bool is_stencil_head (SCM symbol) { - return scm_object_property (symbol, ly_symbol2scm ("stencil-head?")) - == SCM_BOOL_T; + return to_boolean (scm_object_property (symbol, ly_symbol2scm ("stencil-head?"))); } SCM diff --git a/lily/stencil-integral.cc b/lily/stencil-integral.cc index 91f1333867..0bdb00a8ed 100644 --- a/lily/stencil-integral.cc +++ b/lily/stencil-integral.cc @@ -113,7 +113,7 @@ get_number_list (SCM l) if (scm_is_number (scm_car (l))) return l; SCM res = get_number_list (scm_car (l)); - if (res == SCM_BOOL_F) + if (scm_is_false (res)) return get_number_list (scm_cdr (l)); return res; } @@ -129,19 +129,18 @@ get_path_list (SCM l) { if (scm_is_pair (l)) { - if (scm_memv (scm_car (l), - scm_list_n (ly_symbol2scm ("moveto"), - ly_symbol2scm ("rmoveto"), - ly_symbol2scm ("lineto"), - ly_symbol2scm ("rlineto"), - ly_symbol2scm ("curveto"), - ly_symbol2scm ("rcurveto"), - ly_symbol2scm ("closepath"), - SCM_UNDEFINED)) - != SCM_BOOL_F) + if (scm_is_true (scm_memv (scm_car (l), + scm_list_n (ly_symbol2scm ("moveto"), + ly_symbol2scm ("rmoveto"), + ly_symbol2scm ("lineto"), + ly_symbol2scm ("rlineto"), + ly_symbol2scm ("curveto"), + ly_symbol2scm ("rcurveto"), + ly_symbol2scm ("closepath"), + SCM_UNDEFINED)))) return l; SCM res = get_path_list (scm_car (l)); - if (res == SCM_BOOL_F) + if (scm_is_false (res)) return get_path_list (scm_cdr (l)); return res; } @@ -530,8 +529,8 @@ all_commands_to_absolute_and_group (SCM expr) bool first = true; while (scm_is_pair (expr)) { - if (scm_car (expr) == ly_symbol2scm ("moveto") - || (scm_car (expr) == ly_symbol2scm ("rmoveto") && first)) + if (scm_is_eq (scm_car (expr), ly_symbol2scm ("moveto")) + || (scm_is_eq (scm_car (expr), ly_symbol2scm ("rmoveto")) && first)) { Real x = robust_scm2double (scm_cadr (expr), 0.0); Real y = robust_scm2double (scm_caddr (expr), 0.0); @@ -539,7 +538,7 @@ all_commands_to_absolute_and_group (SCM expr) current = start; expr = scm_cdddr (expr); } - if (scm_car (expr) == ly_symbol2scm ("rmoveto")) + if (scm_is_eq (scm_car (expr), ly_symbol2scm ("rmoveto"))) { Real x = robust_scm2double (scm_cadr (expr), 0.0); Real y = robust_scm2double (scm_caddr (expr), 0.0); @@ -547,7 +546,7 @@ all_commands_to_absolute_and_group (SCM expr) current = start; expr = scm_cdddr (expr); } - else if (scm_car (expr) == ly_symbol2scm ("lineto")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("lineto"))) { Real x = robust_scm2double (scm_cadr (expr), 0.0); Real y = robust_scm2double (scm_caddr (expr), 0.0); @@ -559,7 +558,7 @@ all_commands_to_absolute_and_group (SCM expr) current = Offset (x, y); expr = scm_cdddr (expr); } - else if (scm_car (expr) == ly_symbol2scm ("rlineto")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("rlineto"))) { Real x = robust_scm2double (scm_cadr (expr), 0.0); Real y = robust_scm2double (scm_caddr (expr), 0.0); @@ -571,7 +570,7 @@ all_commands_to_absolute_and_group (SCM expr) current = (Offset (x, y) + current); expr = scm_cdddr (expr); } - else if (scm_car (expr) == ly_symbol2scm ("curveto")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("curveto"))) { Real x1 = robust_scm2double (scm_cadr (expr), 0.0); expr = scm_cddr (expr); @@ -597,7 +596,7 @@ all_commands_to_absolute_and_group (SCM expr) out); current = Offset (x3, y3); } - else if (scm_car (expr) == ly_symbol2scm ("rcurveto")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("rcurveto"))) { Real x1 = robust_scm2double (scm_cadr (expr), 0.0); expr = scm_cddr (expr); @@ -623,7 +622,7 @@ all_commands_to_absolute_and_group (SCM expr) out); current = (Offset (x3, y3) + current); } - else if (scm_car (expr) == ly_symbol2scm ("closepath")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("closepath"))) { if ((current[X_AXIS] != start[X_AXIS]) || (current[Y_AXIS] != start[Y_AXIS])) { @@ -825,9 +824,9 @@ stencil_dispatcher (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, { if (not scm_is_pair (expr)) return; - if (scm_car (expr) == ly_symbol2scm ("draw-line")) + if (scm_is_eq (scm_car (expr), ly_symbol2scm ("draw-line"))) make_draw_line_boxes (boxes, buildings, trans, scm_cdr (expr), true); - else if (scm_car (expr) == ly_symbol2scm ("dashed-line")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("dashed-line"))) { expr = scm_cdr (expr); SCM th = scm_car (expr); @@ -839,7 +838,7 @@ stencil_dispatcher (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, SCM x2 = scm_car (expr); make_draw_line_boxes (boxes, buildings, trans, scm_list_5 (th, scm_from_double (0.0), scm_from_double (0.0), x1, x2), true); } - else if (scm_car (expr) == ly_symbol2scm ("circle")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("circle"))) { expr = scm_cdr (expr); SCM rad = scm_car (expr); @@ -855,7 +854,7 @@ stencil_dispatcher (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, SCM_BOOL_T, SCM_UNDEFINED)); } - else if (scm_car (expr) == ly_symbol2scm ("ellipse")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("ellipse"))) { expr = scm_cdr (expr); SCM x_rad = scm_car (expr); @@ -873,17 +872,17 @@ stencil_dispatcher (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, SCM_BOOL_T, SCM_UNDEFINED)); } - else if (scm_car (expr) == ly_symbol2scm ("partial-ellipse")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("partial-ellipse"))) make_partial_ellipse_boxes (boxes, buildings, trans, scm_cdr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("round-filled-box")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("round-filled-box"))) make_round_filled_box_boxes (boxes, trans, scm_cdr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("named-glyph")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("named-glyph"))) make_named_glyph_boxes (boxes, buildings, trans, scm_cdr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("polygon")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("polygon"))) make_polygon_boxes (boxes, buildings, trans, scm_cdr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("path")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("path"))) make_path_boxes (boxes, buildings, trans, scm_cdr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("glyph-string")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("glyph-string"))) make_glyph_string_boxes (boxes, buildings, trans, scm_cdr (expr)); else { @@ -908,9 +907,9 @@ stencil_traverser (PangoMatrix trans, SCM expr) { if (scm_is_null (expr)) return vector<Transform_matrix_and_expression> (); - else if (expr == ly_string2scm ("")) + else if (scm_is_eq (expr, ly_string2scm (""))) return vector<Transform_matrix_and_expression> (); - else if (scm_car (expr) == ly_symbol2scm ("combine-stencil")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("combine-stencil"))) { vector<Transform_matrix_and_expression> out; for (SCM s = scm_cdr (expr); scm_is_pair (s); s = scm_cdr (s)) @@ -920,23 +919,23 @@ stencil_traverser (PangoMatrix trans, SCM expr) } return out; } - else if (scm_car (expr) == ly_symbol2scm ("footnote")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("footnote"))) return vector<Transform_matrix_and_expression> (); - else if (scm_car (expr) == ly_symbol2scm ("translate-stencil")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("translate-stencil"))) { Real x = robust_scm2double (scm_caadr (expr), 0.0); Real y = robust_scm2double (scm_cdadr (expr), 0.0); pango_matrix_translate (&trans, x, y); return stencil_traverser (trans, scm_caddr (expr)); } - else if (scm_car (expr) == ly_symbol2scm ("scale-stencil")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("scale-stencil"))) { Real x = robust_scm2double (scm_caadr (expr), 0.0); Real y = robust_scm2double (scm_cadadr (expr), 0.0); pango_matrix_scale (&trans, x, y); return stencil_traverser (trans, scm_caddr (expr)); } - else if (scm_car (expr) == ly_symbol2scm ("rotate-stencil")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("rotate-stencil"))) { Real ang = robust_scm2double (scm_caadr (expr), 0.0); Real x = robust_scm2double (scm_car (scm_cadadr (expr)), 0.0); @@ -946,16 +945,16 @@ stencil_traverser (PangoMatrix trans, SCM expr) pango_matrix_translate (&trans, -x, -y); return stencil_traverser (trans, scm_caddr (expr)); } - else if (scm_car (expr) == ly_symbol2scm ("delay-stencil-evaluation")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("delay-stencil-evaluation"))) // should not use the place-holder text, but no need for the warning below return vector<Transform_matrix_and_expression> (); - else if (scm_car (expr) == ly_symbol2scm ("grob-cause")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("grob-cause"))) return stencil_traverser (trans, scm_caddr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("color")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("color"))) return stencil_traverser (trans, scm_caddr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("transparent-stencil")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("transparent-stencil"))) return stencil_traverser (trans, scm_cadr (expr)); - else if (scm_car (expr) == ly_symbol2scm ("id")) + else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("id"))) return stencil_traverser (trans, scm_caddr (expr)); else { diff --git a/lily/stencil-interpret.cc b/lily/stencil-interpret.cc index 26e891dfb7..87e6496de7 100644 --- a/lily/stencil-interpret.cc +++ b/lily/stencil-interpret.cc @@ -32,28 +32,28 @@ interpret_stencil_expression (SCM expr, SCM head = scm_car (expr); - if (head == ly_symbol2scm ("delay-stencil-evaluation")) + if (scm_is_eq (head, ly_symbol2scm ("delay-stencil-evaluation"))) { interpret_stencil_expression (scm_force (scm_cadr (expr)), func, func_arg, o); return; } - if (head == ly_symbol2scm ("transparent-stencil")) + if (scm_is_eq (head, ly_symbol2scm ("transparent-stencil"))) return; - if (head == ly_symbol2scm ("footnote")) + if (scm_is_eq (head, ly_symbol2scm ("footnote"))) return; - if (head == ly_symbol2scm ("translate-stencil")) + if (scm_is_eq (head, ly_symbol2scm ("translate-stencil"))) { o += ly_scm2offset (scm_cadr (expr)); expr = scm_caddr (expr); } - else if (head == ly_symbol2scm ("combine-stencil")) + else if (scm_is_eq (head, ly_symbol2scm ("combine-stencil"))) { for (SCM x = scm_cdr (expr); scm_is_pair (x); x = scm_cdr (x)) interpret_stencil_expression (scm_car (x), func, func_arg, o); return; } - else if (head == ly_symbol2scm ("grob-cause")) + else if (scm_is_eq (head, ly_symbol2scm ("grob-cause"))) { SCM grob = scm_cadr (expr); @@ -65,7 +65,7 @@ interpret_stencil_expression (SCM expr, (*func) (func_arg, scm_list_1 (ly_symbol2scm ("no-origin"))); return; } - else if (head == ly_symbol2scm ("color")) + else if (scm_is_eq (head, ly_symbol2scm ("color"))) { SCM color = scm_cadr (expr); SCM r = scm_car (color); @@ -78,7 +78,7 @@ interpret_stencil_expression (SCM expr, return; } - else if (head == ly_symbol2scm ("id")) + else if (scm_is_eq (head, ly_symbol2scm ("id"))) { SCM id = scm_cadr (expr); @@ -88,7 +88,7 @@ interpret_stencil_expression (SCM expr, return; } - else if (head == ly_symbol2scm ("rotate-stencil")) + else if (scm_is_eq (head, ly_symbol2scm ("rotate-stencil"))) { SCM args = scm_cadr (expr); SCM angle = scm_car (args); @@ -104,7 +104,7 @@ interpret_stencil_expression (SCM expr, return; } - else if (head == ly_symbol2scm ("scale-stencil")) + else if (scm_is_eq (head, ly_symbol2scm ("scale-stencil"))) { SCM args = scm_cadr (expr); SCM x_scale = scm_car (args); @@ -142,7 +142,7 @@ find_font_function (void *fs, SCM x) { Font_list *me = (Font_list *) fs; - if (scm_car (x) == ly_symbol2scm ("placebox")) + if (scm_is_eq (scm_car (x), ly_symbol2scm ("placebox"))) { SCM args = scm_cdr (x); SCM what = scm_caddr (args); @@ -150,9 +150,9 @@ find_font_function (void *fs, SCM x) if (scm_is_pair (what)) { SCM head = scm_car (what); - if (ly_symbol2scm ("text") == head) + if (scm_is_eq (head, ly_symbol2scm ("text"))) me->fonts_ = scm_cons (scm_cadr (what), me->fonts_); - else if (head == ly_symbol2scm ("char")) + else if (scm_is_eq (head, ly_symbol2scm ("char"))) me->fonts_ = scm_cons (scm_cadr (what), me->fonts_); } } diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index ebf3cd6c15..f337beb3f4 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -116,15 +116,15 @@ LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge", Stencil *s2 = Stencil::unsmob (second); Stencil result; - SCM_ASSERT_TYPE (s1 || first == SCM_BOOL_F || first == SCM_EOL, + SCM_ASSERT_TYPE (s1 || scm_is_false (first) || scm_is_null (first), first, SCM_ARG1, __FUNCTION__, "Stencil, #f or ()"); - SCM_ASSERT_TYPE (s2 || second == SCM_BOOL_F || second == SCM_EOL, + SCM_ASSERT_TYPE (s2 || scm_is_false (second) || scm_is_null (second), second, SCM_ARG4, __FUNCTION__, "Stencil, #f or ()"); LY_ASSERT_TYPE (is_axis, axis, 2); LY_ASSERT_TYPE (is_direction, direction, 3); Real p = 0.0; - if (padding != SCM_UNDEFINED) + if (!SCM_UNBNDP (padding)) { LY_ASSERT_TYPE (scm_is_number, padding, 5); p = scm_to_double (padding); @@ -163,15 +163,15 @@ LY_DEFINE (ly_stencil_stack, "ly:stencil-stack", Stencil *s2 = Stencil::unsmob (second); Stencil result; - SCM_ASSERT_TYPE (s1 || first == SCM_BOOL_F || first == SCM_EOL, + SCM_ASSERT_TYPE (s1 || scm_is_false (first) || scm_is_null (first), first, SCM_ARG1, __FUNCTION__, "Stencil, #f or ()"); - SCM_ASSERT_TYPE (s2 || second == SCM_BOOL_F || second == SCM_EOL, + SCM_ASSERT_TYPE (s2 || scm_is_false (second) || scm_is_null (second), second, SCM_ARG4, __FUNCTION__, "Stencil, #f or ()"); LY_ASSERT_TYPE (is_axis, axis, 2); LY_ASSERT_TYPE (is_direction, direction, 3); Real p = 0.0; - if (padding != SCM_UNDEFINED) + if (!SCM_UNBNDP (padding)) { LY_ASSERT_TYPE (scm_is_number, padding, 5); p = scm_to_double (padding); @@ -252,14 +252,14 @@ LY_DEFINE (ly_make_stencil, "ly:make-stencil", expr, SCM_ARG1, __FUNCTION__, "registered stencil expression"); Interval x; - if (xext != SCM_UNDEFINED) + if (!SCM_UNBNDP (xext)) { LY_ASSERT_TYPE (is_number_pair, xext, 2); x = ly_scm2interval (xext); } Interval y; - if (yext != SCM_UNDEFINED) + if (!SCM_UNBNDP (yext)) { LY_ASSERT_TYPE (is_number_pair, yext, 3); y = ly_scm2interval (yext); diff --git a/lily/stencil.cc b/lily/stencil.cc index 41eb2f1e85..980618ceaa 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -55,7 +55,7 @@ Stencil::extent (Axis a) const bool Stencil::is_empty () const { - return (expr_ == SCM_EOL + return (scm_is_null (expr_) || dim_.is_empty ()); } diff --git a/lily/stream-event-scheme.cc b/lily/stream-event-scheme.cc index c1d0543f8c..bf8056e16a 100644 --- a/lily/stream-event-scheme.cc +++ b/lily/stream-event-scheme.cc @@ -36,7 +36,7 @@ LY_DEFINE (ly_make_stream_event, "ly:make-stream-event", /* should be scm_list_p, but scm_list_p is expensive. */ LY_ASSERT_TYPE (scm_is_pair, proplist, 2); - if (proplist == SCM_UNDEFINED) + if (SCM_UNBNDP (proplist)) proplist = SCM_EOL; Stream_event *e = new Stream_event (cl, proplist); diff --git a/lily/stream-event.cc b/lily/stream-event.cc index 674f22fda4..7fb596c264 100644 --- a/lily/stream-event.cc +++ b/lily/stream-event.cc @@ -68,7 +68,7 @@ bool Stream_event::internal_in_event_class (SCM class_name) { SCM cl = get_property ("class"); - return scm_c_memq (class_name, cl) != SCM_BOOL_F; + return scm_is_true (scm_c_memq (class_name, cl)); } MAKE_SCHEME_CALLBACK (Stream_event, undump, 1); @@ -87,9 +87,9 @@ Stream_event::make_transposable () SCM val = scm_cdr (entry); if ((Pitch::is_smob (val) - || (prop == ly_symbol2scm ("element") && Music::is_smob (val)) - || (prop == ly_symbol2scm ("elements") && scm_is_pair (val)) - || (prop == ly_symbol2scm ("pitch-alist") && scm_is_pair (val))) + || (scm_is_eq (prop, ly_symbol2scm ("element")) && Music::is_smob (val)) + || (scm_is_eq (prop, ly_symbol2scm ("elements")) && scm_is_pair (val)) + || (scm_is_eq (prop, ly_symbol2scm ("pitch-alist")) && scm_is_pair (val))) && scm_is_false (scm_assq (prop, mutable_property_alist_))) mutable_property_alist_ = scm_acons (prop, ly_music_deep_copy (val), mutable_property_alist_); diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index ebc77e86ba..73a3c8ccc7 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -132,10 +132,10 @@ Bracket_nesting_group::from_list (SCM x) node->from_list (entry); children_.push_back (node); } - else if (entry == ly_symbol2scm ("SystemStartBrace") - || entry == ly_symbol2scm ("SystemStartBracket") - || entry == ly_symbol2scm ("SystemStartBar") - || entry == ly_symbol2scm ("SystemStartSquare")) + else if (scm_is_eq (entry, ly_symbol2scm ("SystemStartBrace")) + || scm_is_eq (entry, ly_symbol2scm ("SystemStartBracket")) + || scm_is_eq (entry, ly_symbol2scm ("SystemStartBar")) + || scm_is_eq (entry, ly_symbol2scm ("SystemStartSquare"))) symbol_ = entry; else children_.push_back (new Bracket_nesting_staff (0)); diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 6a898559b3..563a035acc 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -129,13 +129,13 @@ System_start_delimiter::print (SCM smob) } Stencil m; - if (glyph_sym == ly_symbol2scm ("bracket")) + if (scm_is_eq (glyph_sym, ly_symbol2scm ("bracket"))) m = staff_bracket (me, len); - else if (glyph_sym == ly_symbol2scm ("brace")) + else if (scm_is_eq (glyph_sym, ly_symbol2scm ("brace"))) m = staff_brace (me, len); - else if (glyph_sym == ly_symbol2scm ("bar-line")) + else if (scm_is_eq (glyph_sym, ly_symbol2scm ("bar-line"))) m = simple_bar (me, len); - else if (glyph_sym == ly_symbol2scm ("line-bracket")) + else if (scm_is_eq (glyph_sym, ly_symbol2scm ("line-bracket"))) m = line_bracket (me, len); m.translate_axis (ext.center (), Y_AXIS); diff --git a/lily/system.cc b/lily/system.cc index 6d6b5ac8f3..61779473c3 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -594,7 +594,7 @@ System::get_paper_system () Grob *g = entries[j].grob_; Stencil st = g->get_print_stencil (); - if (st.expr () == SCM_EOL) + if (scm_is_null (st.expr ())) continue; Offset o; diff --git a/lily/tab-note-heads-engraver.cc b/lily/tab-note-heads-engraver.cc index 42dd7e4b1f..4d47d77982 100644 --- a/lily/tab-note-heads-engraver.cc +++ b/lily/tab-note-heads-engraver.cc @@ -111,12 +111,12 @@ Tab_note_heads_engraver::process_music () bool length_changed = (note_events_.size () != fret_count); vsize index; - if (string_fret_finger != SCM_EOL) + if (!scm_is_null (string_fret_finger)) for (vsize i = 0; i < fret_count; i++) { note_entry = scm_list_ref (string_fret_finger, scm_from_int (i)); string_number = scm_car (note_entry); - if (string_number != SCM_BOOL_F) + if (scm_is_true (string_number)) { fret = scm_cadr (note_entry); fret_label = scm_call_3 (fret_procedure, diff --git a/lily/text-interface.cc b/lily/text-interface.cc index 909ab9b099..012718d621 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -91,7 +91,7 @@ Text_interface::interpret_string (SCM layout_smob, SCM_BOOL_F); SCM music_encodings = ly_lily_module_constant ("all-music-font-encodings"); - bool is_music = (scm_memq (encoding, music_encodings) != SCM_BOOL_F); + bool is_music = scm_is_true (scm_memq (encoding, music_encodings)); return fm->text_stencil (layout, str, is_music).smobbed_copy (); } diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index f944454a71..1faa3d9445 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -1200,7 +1200,8 @@ Tie_formatting_problem::set_manual_tie_configuration (SCM manual_configs) { spec.has_manual_position_ = true; spec.manual_position_ = scm_to_double (scm_car (entry)); - spec.has_manual_delta_y_ = (scm_inexact_p (scm_car (entry)) == SCM_BOOL_T); + /* TODO: check whether inexact? is an appropriate condition here */ + spec.has_manual_delta_y_ = (scm_is_true (scm_inexact_p (scm_car (entry)))); } if (scm_is_number (scm_cdr (entry))) diff --git a/lily/tie-specification.cc b/lily/tie-specification.cc index 0413495713..0ccf2c5beb 100644 --- a/lily/tie-specification.cc +++ b/lily/tie-specification.cc @@ -33,7 +33,7 @@ Tie_specification::from_grob (Grob *tie) SCM pos_scm = tie->get_property ("staff-position"); if (scm_is_number (pos_scm)) { - has_manual_delta_y_ = (scm_inexact_p (pos_scm) == SCM_BOOL_T); + has_manual_delta_y_ = !ly_is_rational (pos_scm); manual_position_ = scm_to_double (tie->get_property ("staff-position")); has_manual_position_ = true; } diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index 53205cbb6c..46e42679aa 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -80,7 +80,7 @@ Time_signature_engraver::process_music () time_signature_ = make_item ("TimeSignature", time_cause_); time_signature_->set_property ("fraction", fr); - if (last_time_fraction_ == SCM_BOOL_F) + if (scm_is_false (last_time_fraction_)) time_signature_->set_property ("break-visibility", get_property ("initialTimeSignatureVisibility")); @@ -104,7 +104,7 @@ Time_signature_engraver::process_music () void Time_signature_engraver::stop_translation_timestep () { - if (time_signature_ && (time_cause_ != SCM_EOL)) + if (time_signature_ && !scm_is_null (time_cause_)) { Moment *mp = Moment::unsmob (get_property ("measurePosition")); if (mp && (mp->main_part_ > Rational (0)) diff --git a/lily/translator-ctors.cc b/lily/translator-ctors.cc index 1368e73762..168f1ad6de 100644 --- a/lily/translator-ctors.cc +++ b/lily/translator-ctors.cc @@ -60,7 +60,7 @@ get_translator (SCM sym) if (global_translator_dict) global_translator_dict->try_retrieve (sym, &v); - if (v == SCM_BOOL_F) + if (scm_is_false (v)) { warning (_f ("unknown translator: `%s'", ly_symbol2string (sym).c_str ())); return 0; diff --git a/lily/translator-group-ctors.cc b/lily/translator-group-ctors.cc index 92655f21a4..e14ed76082 100644 --- a/lily/translator-group-ctors.cc +++ b/lily/translator-group-ctors.cc @@ -28,13 +28,13 @@ Translator_group * get_translator_group (SCM sym) { - if (sym == ly_symbol2scm ("Engraver_group")) + if (scm_is_eq (sym, ly_symbol2scm ("Engraver_group"))) return new Engraver_group (); - else if (sym == ly_symbol2scm ("Performer_group")) + else if (scm_is_eq (sym, ly_symbol2scm ("Performer_group"))) return new Performer_group (); - else if (sym == ly_symbol2scm ("Score_engraver")) + else if (scm_is_eq (sym, ly_symbol2scm ("Score_engraver"))) return new Score_engraver (); - else if (sym == ly_symbol2scm ("Score_performer")) + else if (scm_is_eq (sym, ly_symbol2scm ("Score_performer"))) return new Score_performer (); error (_f ("fatal error. Couldn't find type: %s", diff --git a/lily/ttf.cc b/lily/ttf.cc index c46b9e9f75..2af774e414 100644 --- a/lily/ttf.cc +++ b/lily/ttf.cc @@ -503,7 +503,7 @@ LY_DEFINE (ly_ttf_ps_name, "ly:ttf-ps-name", LY_ASSERT_TYPE (scm_is_string, ttf_file_name, 1); int i = 0; - if (idx != SCM_UNDEFINED) + if (!SCM_UNBNDP (idx)) { LY_ASSERT_TYPE (scm_is_integer, idx, 2); i = scm_to_int (idx); @@ -553,7 +553,7 @@ LY_DEFINE (ly_ttf_2_pfa, "ly:ttf->pfa", LY_ASSERT_TYPE (scm_is_string, ttf_file_name, 1); int i = 0; - if (idx != SCM_UNDEFINED) + if (!SCM_UNBNDP (idx)) { LY_ASSERT_TYPE (scm_is_integer, idx, 2); i = scm_to_int (idx); diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 5c89378499..28803d5bf6 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -268,7 +268,7 @@ Tuplet_bracket::print (SCM smob) */ SCM bracket_vis_prop = me->get_property ("bracket-visibility"); bool bracket_prop = ly_scm2bool (bracket_vis_prop); // Flag, user has set bracket-visibility prop. - bool bracket = (bracket_vis_prop == ly_symbol2scm ("if-no-beam")); + bool bracket = scm_is_eq (bracket_vis_prop, ly_symbol2scm ("if-no-beam")); if (scm_is_bool (bracket_vis_prop)) bracket_visibility = bracket_prop; else if (bracket) diff --git a/lily/tuplet-number.cc b/lily/tuplet-number.cc index bfe35480b1..381aa994f3 100644 --- a/lily/tuplet-number.cc +++ b/lily/tuplet-number.cc @@ -336,7 +336,7 @@ count_beams_not_touching_stem (SCM beaming) for (SCM s = scm_car (beaming); scm_is_pair (s); s = scm_cdr (s)) { - if (scm_c_memq (scm_car (s), scm_cdr (beaming)) != SCM_BOOL_F) + if (scm_is_true (scm_c_memq (scm_car (s), scm_cdr (beaming)))) ++count; } diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc index cc9a489472..a39e0cef59 100644 --- a/lily/vaticana-ligature-engraver.cc +++ b/lily/vaticana-ligature-engraver.cc @@ -247,7 +247,7 @@ Vaticana_ligature_engraver::align_heads (vector<Grob_info> const &primitives, */ SCM glyph_name_scm = primitive->get_property ("glyph-name"); - if (glyph_name_scm == SCM_EOL) + if (scm_is_null (glyph_name_scm)) { primitive->programming_error ("Vaticana_ligature:" " undefined glyph-name ->" @@ -260,7 +260,7 @@ Vaticana_ligature_engraver::align_heads (vector<Grob_info> const &primitives, if (prev_primitive) /* urgh, need prev_primitive only here */ { SCM delta_pitch_scm = prev_primitive->get_property ("delta-position"); - if (delta_pitch_scm != SCM_EOL) + if (!scm_is_null (delta_pitch_scm)) delta_pitch = scm_to_int (delta_pitch_scm); else { @@ -491,7 +491,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, int delta_pitch; SCM delta_pitch_scm = primitive->get_property ("delta-position"); - if (delta_pitch_scm != SCM_EOL) + if (!scm_is_null (delta_pitch_scm)) delta_pitch = scm_to_int (delta_pitch_scm); else { diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc index fd95c43380..2066716b80 100644 --- a/lily/vaticana-ligature.cc +++ b/lily/vaticana-ligature.cc @@ -86,7 +86,7 @@ vaticana_brew_flexa (Grob *me, Real interval; SCM flexa_height_scm = me->get_property ("flexa-height"); - if (flexa_height_scm != SCM_EOL) + if (!scm_is_null (flexa_height_scm)) interval = scm_to_int (flexa_height_scm); else { @@ -200,7 +200,7 @@ Stencil vaticana_brew_primitive (Grob *me) { SCM glyph_name_scm = me->get_property ("glyph-name"); - if (glyph_name_scm == SCM_EOL) + if (scm_is_null (glyph_name_scm)) { me->programming_error ("Vaticana_ligature: " "undefined glyph-name -> ignoring grob"); @@ -222,7 +222,7 @@ vaticana_brew_primitive (Grob *me) SCM delta_pitch_scm = me->get_property ("delta-position"); int delta_pitch; - if (delta_pitch_scm != SCM_EOL) + if (!scm_is_null (delta_pitch_scm)) delta_pitch = scm_to_int (delta_pitch_scm); else delta_pitch = 0; diff --git a/lily/volta-engraver.cc b/lily/volta-engraver.cc index fe568a5fd5..60c8987b3e 100644 --- a/lily/volta-engraver.cc +++ b/lily/volta-engraver.cc @@ -82,10 +82,10 @@ Volta_engraver::process_music () SCM c = scm_car (cs); if (scm_is_pair (c) - && scm_car (c) == ly_symbol2scm ("volta") + && scm_is_eq (scm_car (c), ly_symbol2scm ("volta")) && scm_is_pair (scm_cdr (c))) { - if (scm_cadr (c) == SCM_BOOL_F) + if (scm_is_false (scm_cadr (c))) end = true; else start_string_ = scm_cadr (c); diff --git a/lily/volta-repeat-iterator.cc b/lily/volta-repeat-iterator.cc index 09c2495f05..bcbc34f8cb 100644 --- a/lily/volta-repeat-iterator.cc +++ b/lily/volta-repeat-iterator.cc @@ -85,8 +85,7 @@ Volta_repeat_iterator::add_repeat_command (SCM what) SCM current_reps = SCM_EOL; Context *where = get_outlet ()->where_defined (reps, ¤t_reps); - if (where - && (current_reps == SCM_EOL || scm_is_pair (current_reps))) + if (where && ly_cheap_is_list (current_reps)) { current_reps = scm_cons (what, current_reps); where->set_property (reps, current_reps); |