lilypond-devel
[Top][All Lists]
Advanced

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

Re: Likely a good frog project for someone with C knowledge


From: David Kastrup
Subject: Re: Likely a good frog project for someone with C knowledge
Date: Wed, 17 Aug 2011 00:51:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Han-Wen Nienhuys <address@hidden> writes:

> The only real problem are boolean conversions because they are very wrong,  
> ie,
>
>   SCM x = ...
>   if (x)  {
>     ..
>   }
>
> for the rest, making lilypond SCM typing clean is just a lot of work
> with no benefits at all.

All of the following would have been caught by this project (I
hand-sifted through a git grep with a few patterns catching only a small
subset of what the debug option would have).

diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc
index 143534e..3c428bc 100644
--- a/lily/axis-group-interface.cc
+++ b/lily/axis-group-interface.cc
@@ -719,7 +719,7 @@ Axis_group_interface::skyline_spacing (Grob *me, 
vector<Grob *> elements)
       vector<Grob *> current_elts;
       current_elts.push_back (elements[i]);
       while (i + 1 < elements.size ()
-             && scm_eq_p (elements[i + 1]->get_property 
("outside-staff-priority"), priority))
+             && scm_is_eq (elements[i + 1]->get_property 
("outside-staff-priority"), priority))
         {
           if (!to_boolean (elements[i + 1]->get_property ("cross-staff")))
             current_elts.push_back (elements[i + 1]);
diff --git a/lily/dispatcher.cc b/lily/dispatcher.cc
index 0e3ad89..6a11654 100644
--- a/lily/dispatcher.cc
+++ b/lily/dispatcher.cc
@@ -77,7 +77,7 @@ Dispatcher::dispatch (SCM sev)
 {
   Stream_event *ev = unsmob_stream_event (sev);
   SCM class_symbol = ev->get_property ("class");
-  if (!scm_symbol_p (class_symbol))
+  if (!scm_is_symbol (class_symbol))
     {
       warning (_ ("Event class should be a symbol"));
       return;
diff --git a/lily/font-select.cc b/lily/font-select.cc
index 3de5a2a..217ce61 100644
--- a/lily/font-select.cc
+++ b/lily/font-select.cc
@@ -123,7 +123,7 @@ select_encoded_font (Output_def *layout, SCM chain)
     return select_pango_font (layout, chain);
   else
 #endif
-    if (scm_instance_p (name))
+    if (scm_is_true (scm_instance_p (name)))
       {
         SCM base_size = scm_slot_ref (name, ly_symbol2scm ("default-size"));
         SCM vec = scm_slot_ref (name, ly_symbol2scm ("size-vector"));
diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc
index a630fd9..254b5ab 100644
--- a/lily/general-scheme.cc
+++ b/lily/general-scheme.cc
@@ -381,7 +381,7 @@ LY_DEFINE (ly_stderr_redirect, "ly:stderr-redirect",
   string m = "w";
   string f = ly_scm2string (file_name);
   FILE *stderrfile;
-  if (mode != SCM_UNDEFINED && scm_string_p (mode))
+  if (scm_is_string (mode))
     m = ly_scm2string (mode);
   /* dup2 and (fileno (current-error-port)) do not work with mingw'c
      gcc -mwindows.  */
diff --git a/lily/sequential-iterator.cc b/lily/sequential-iterator.cc
index 2f0dd51..5ba7a59 100644
--- a/lily/sequential-iterator.cc
+++ b/lily/sequential-iterator.cc
@@ -55,7 +55,7 @@ Sequential_iterator::get_music_list () const
 {
   Music *m = get_music ();
   SCM proc = m->get_property ("elements-callback");
-  if (scm_procedure_p (proc))
+  if (ly_is_procedure (proc))
     return scm_call_1 (proc, m->self_scm ());
   else
     return SCM_EOL;
diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc
index 2a216bd..58cfa41 100644
--- a/lily/staff-spacing.cc
+++ b/lily/staff-spacing.cc
@@ -151,7 +151,7 @@ Staff_spacing::get_spacing (Grob *me, Grob *right_col)
     }
 
   SCM alist = last_grob->get_property ("space-alist");
-  if (!scm_list_p (alist))
+  if (!ly_is_list (alist))
     return Spring ();
 
   SCM space_def = scm_sloppy_assq (ly_symbol2scm ("first-note"), alist);


-- 
David Kastrup




reply via email to

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