]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lily-guile.cc
mutopia move
[lilypond.git] / lily / lily-guile.cc
index cf2e275027e91f0166753805114a0c476546cfe4..69990c82b1015e7253c3c2623afd3fc9d4e3c08a 100644 (file)
@@ -18,7 +18,7 @@
 #include "main.hh"
 #include "simple-file-storage.hh"
 #include "file-path.hh"
-#include "debug.hh"
+#include "warn.hh"
 #include "direction.hh"
 #include "offset.hh"
 #include "interval.hh"
@@ -218,7 +218,7 @@ ly_scm2string (SCM s)
 }
 
 SCM
-index_cell (SCM s, Direction d)
+index_get_cell (SCM s, Direction d)
 {
   assert (d);
   return (d == LEFT) ? ly_car (s) : ly_cdr (s);
@@ -524,14 +524,26 @@ init_functions ()
 ADD_SCM_INIT_FUNC (funcs, init_functions);
 
 SCM
-ly_deep_copy (SCM l)
+ly_deep_copy (SCM src)
 {
-  if (gh_pair_p (l))
+  if (gh_pair_p (src))
     {
-      return gh_cons (ly_deep_copy (ly_car (l)), ly_deep_copy (ly_cdr (l)));
+      return gh_cons (ly_deep_copy (ly_car (src)), ly_deep_copy (ly_cdr (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++)
+       {
+         SCM si = gh_int2scm (i);
+         scm_vector_set_x (nv, si, ly_deep_copy (scm_vector_ref (src, si))); 
+       }
     }
   else
-    return l;
+    return src;
+
+  return src;
 }
 
 
@@ -785,3 +797,18 @@ display_list (SCM s)
   scm_puts (")", p);
   return SCM_UNSPECIFIED;
 }
+
+Slice
+int_list_to_slice (SCM l)
+{
+  Slice s;
+  s.set_empty ();
+  for (; gh_pair_p (l); l = gh_cdr (l))
+    {
+      if (gh_number_p (gh_car (l)))
+       s.add_point (gh_scm2int (gh_car (l))); 
+    }
+
+  return s;
+}
+