lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixes boolean/SCM confusions, part 1. (issue 4875054)


From: cecile . hauchemaille
Subject: Fixes boolean/SCM confusions, part 1. (issue 4875054)
Date: Thu, 18 Aug 2011 13:19:10 +0000

Reviewers: ,

Message:
Hi everyone,

I started working on this issue:
http://lists.gnu.org/archive/html/lilypond-devel/2011-08/msg00646.html
Could you tell me if this is correct?

Regards,
C├ęcile Hauchemaille

Description:
Fixes boolean/SCM confusions, part 1.

Please review this at http://codereview.appspot.com/4875054/

Affected files:
  M lily/accidental-engraver.cc
  M lily/accidental-placement.cc
  M lily/ambitus-engraver.cc
  M lily/auto-beam-engraver.cc
  M lily/axis-group-interface.cc
  M lily/bar-check-iterator.cc
  M lily/bar-engraver.cc
  M lily/beam.cc
  M lily/lily-guile.cc


Index: lily/accidental-engraver.cc
diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc
index bc013f516f34d3d834ab28ce2ee5eb8b19232d6e..24273f2a97d0c26ecb721d43cf48c31591f966c8 100644
--- a/lily/accidental-engraver.cc
+++ b/lily/accidental-engraver.cc
@@ -316,7 +316,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_to_int (left_objects_[i]->get_property ("side-axis")) == X_AXIS)
         Side_position_interface::add_support (left_objects_[i], a);
     }

@@ -452,8 +452,9 @@ Accidental_engraver::acknowledge_rhythmic_head (Grob_info info)
       /*
         string harmonics usually don't have accidentals.
       */
- if (info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic")
-          || to_boolean (get_property ("harmonicAccidentals")))
+      if (!ly_is_equal (info.grob ()->get_property ("style"),
+                        ly_symbol2scm ("harmonic"))
+            || to_boolean (get_property ("harmonicAccidentals")))
         {
           Accidental_entry entry;
           entry.head_ = info.grob ();
@@ -494,7 +495,7 @@ void
 Accidental_engraver::process_music ()
 {
   SCM sig = get_property ("keySignature");
-  if (last_keysig_ != sig)
+  if (!ly_is_equal (last_keysig_, sig))
     update_local_key_signature (sig);
 }

Index: lily/accidental-placement.cc
diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc
index e4cf13c10abfd70c368d9c26bd15bee022b154e4..6a386026639c80150bfbacdb296f85d4073edd86 100644
--- a/lily/accidental-placement.cc
+++ b/lily/accidental-placement.cc
@@ -59,7 +59,7 @@ Accidental_placement::add_accidental (Grob *me, Grob *a)
   SCM accs = me->get_object ("accidental-grobs");
   SCM key = scm_from_int (n);
   SCM entry = scm_assq (key, accs);
-  if (entry == SCM_BOOL_F)
+  if (scm_is_false (entry))
     entry = SCM_EOL;
   else
     entry = scm_cdr (entry);
Index: lily/ambitus-engraver.cc
diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc
index ae692d380a141412ee08c5331f0c6236fe84ba01..572da8eff932705b57588a633fb96326c920d968 100644
--- a/lily/ambitus-engraver.cc
+++ b/lily/ambitus-engraver.cc
@@ -170,11 +170,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_false (handle)
? robust_scm2rational (scm_cdr (handle), Rational (0))
                                : Rational (0);

Index: lily/auto-beam-engraver.cc
diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc
index 76a3023e10bb1d251619270e1040cf8e85459d1a..94672f2008bb0f5ec4532f371259280a1f7e9cd6 100644
--- a/lily/auto-beam-engraver.cc
+++ b/lily/auto-beam-engraver.cc
@@ -169,12 +169,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_false (scm_call_4 (get_property ("autoBeamCheck"),
+                        context ()->self_scm (),
+                        scm_from_int (dir),
+                        test_mom.smobbed_copy (),
+                        dur.smobbed_copy ()));
 }

 void
Index: lily/axis-group-interface.cc
diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc
index ac778b05364b44ef269dddb48261d2adc2e97737..6e5882b484a288d39bb437e0b4e0f1386309292d 100644
--- a/lily/axis-group-interface.cc
+++ b/lily/axis-group-interface.cc
@@ -68,7 +68,7 @@ Axis_group_interface::has_axis (Grob *me, Axis a)
 {
   SCM axes = me->get_property ("axes");

-  return (SCM_BOOL_F != scm_memq (scm_from_int (a), axes));
+  return (!scm_is_false (scm_memq (scm_from_int (a), axes)));
 }

 Interval
Index: lily/bar-check-iterator.cc
diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc
index a4d8f4c44b9f0c520899582590ba9b3b8b4e026d..a278dbd45c7b216f941652fc044661409a3b8a66 100644
--- a/lily/bar-check-iterator.cc
+++ b/lily/bar-check-iterator.cc
@@ -49,8 +49,7 @@ Bar_check_iterator::process (Moment m)
     {
       Context *tr = get_outlet ();

-      SCM check = tr->get_property ("ignoreBarChecks");
-      if (to_boolean (check))
+      if (to_boolean (tr->get_property ("ignoreBarChecks")))
         return;

       SCM mp = tr->get_property ("measurePosition");
Index: lily/bar-engraver.cc
diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc
index 8a75d25619a2d0f017b6f7a21f0e2e030cccc801..ccbece9f1e5881bc0ec279d08dba1ff3b100916d 100644
--- a/lily/bar-engraver.cc
+++ b/lily/bar-engraver.cc
@@ -61,7 +61,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);
     }
 }
Index: lily/beam.cc
diff --git a/lily/beam.cc b/lily/beam.cc
index 2d973246cf0ebf75a6c5147b09e7e32d261b6f25..278fdf01633e095e71a1eabb3306c339dc188ee9 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -1434,7 +1434,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_false (scm_c_memq (scm_car (s), scm_cdr (beaming))))

         l.add_point (scm_to_int (scm_car (s)));
     }
@@ -1572,8 +1572,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
Index: lily/lily-guile.cc
diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc
index ff3f7064bf62d4666d8cc4c8193ea6b2cc8b33af..6cf0877bd8dc73c861d7171d76c361d762d5710a 100644
--- a/lily/lily-guile.cc
+++ b/lily/lily-guile.cc
@@ -404,7 +404,7 @@ 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 ok;

   if (!scm_is_symbol (sym))
@@ -424,7 +424,7 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol)

   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 (),
@@ -551,7 +551,7 @@ robust_scm2string (SCM k, 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;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]