]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/break-substitution.cc
*** empty log message ***
[lilypond.git] / lily / break-substitution.cc
index 59664579f757521a4408267a7cafc2bcb78eff18..f7dee18a75b9e204699bb7440c1eb96a08b58f1a 100644 (file)
@@ -90,21 +90,19 @@ do_break_substitution (SCM src)
  again:
  
   if (unsmob_grob (src))
+    return substitute_grob (unsmob_grob (src));
+  else if (ly_c_vector_p (src))
     {
-      return substitute_grob (unsmob_grob (src));
-    }
-  else if (gh_vector_p (src))
-    {
-      int  l = SCM_VECTOR_LENGTH (src);
-      SCM nv = scm_c_make_vector (l, SCM_UNDEFINED);
-
-      for (int i  =0 ; i< l ; i++)
+      int len = SCM_VECTOR_LENGTH (src);
+      SCM nv = scm_c_make_vector (len, SCM_UNDEFINED);
+      for (int i = 0; i < len; i++)
        {
          SCM si = scm_int2num (i);
-         scm_vector_set_x (nv, si, do_break_substitution (scm_vector_ref (src, si))); 
+         scm_vector_set_x (nv, si,
+                           do_break_substitution (scm_vector_ref (src, si))); 
        }
     }
-  else if (ly_pair_p (src)) 
+  else if (ly_c_pair_p (src)) 
     {
       /*
        UGH! breaks on circular lists.
@@ -113,7 +111,7 @@ do_break_substitution (SCM src)
       SCM oldcdr = ly_cdr (src);
       
       if (newcar == SCM_UNDEFINED
-         && (gh_pair_p (oldcdr) || oldcdr == SCM_EOL))
+         && (ly_c_pair_p (oldcdr) || oldcdr == SCM_EOL))
        {
          /*
            This is tail-recursion, ie. 
@@ -144,13 +142,13 @@ substitute_grob_list (SCM grob_list)
   SCM l = SCM_EOL;
   SCM * tail = &l;
 
-  for (SCM s = grob_list; gh_pair_p (s); s =  gh_cdr (s))
+  for (SCM s = grob_list; ly_c_pair_p (s); s =  ly_cdr (s))
     {
-      SCM n= substitute_grob (unsmob_grob (gh_car (s)));
+      SCM n= substitute_grob (unsmob_grob (ly_car (s)));
 
       if (n != SCM_UNDEFINED)
        {
-         *tail = gh_cons (n, SCM_EOL);
+         *tail = scm_cons (n, SCM_EOL);
          tail = SCM_CDRLOC (*tail);
        }
     }
@@ -352,9 +350,9 @@ Spanner::fast_fubstitute_grob_list (SCM sym,
   
   int sp_index = len;
   int it_index = 0;
-  for (SCM s = grob_list; gh_pair_p (s); s = gh_cdr (s))
+  for (SCM s = grob_list; ly_c_pair_p (s); s = ly_cdr (s))
     {
-      Grob * g = unsmob_grob (gh_car (s));
+      Grob * g = unsmob_grob (ly_car (s));
 
       Slice sr = grob_system_range (g);
       sr.intersect (system_range);
@@ -449,8 +447,6 @@ Spanner::fast_fubstitute_grob_list (SCM sym,
 }
 
 
-SCM grob_list_p; 
-
 /*
   Although the substitution can be written as
 
@@ -467,15 +463,14 @@ SCM grob_list_p;
 SCM
 substitute_mutable_property_alist (SCM alist)
 {
-  if (!grob_list_p)
-    grob_list_p = scm_c_eval_string ("grob-list?");
+  SCM grob_list_p = ly_scheme_function ("grob-list?");
 
   SCM l = SCM_EOL;
   SCM *tail = &l;
-  for (SCM s = alist; gh_pair_p (s); s = gh_cdr (s))
+  for (SCM s = alist; ly_c_pair_p (s); s = ly_cdr (s))
     {
-      SCM sym = gh_caar (s);
-      SCM val = gh_cdar (s);
+      SCM sym = ly_caar (s);
+      SCM val = ly_cdar (s);
       SCM type = scm_object_property (sym, ly_symbol2scm ("backend-type?"));
 
       if (type == grob_list_p)
@@ -483,7 +478,7 @@ substitute_mutable_property_alist (SCM alist)
       else
        val = do_break_substitution (val);
 
-      *tail = gh_cons (gh_cons (sym, val), SCM_EOL);
+      *tail = scm_cons (scm_cons (sym, val), SCM_EOL);
       tail = SCM_CDRLOC (*tail);
     }
 
@@ -499,6 +494,7 @@ Spanner::substitute_one_mutable_property (SCM sym,
   Spanner*s = this;
   
   bool fast_done = false;
+  SCM grob_list_p = ly_scheme_function ("grob-list?");
   if (type == grob_list_p)
     fast_done = s->fast_fubstitute_grob_list (sym, val);