]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lily-guile.cc
TupletBracket and TupletNumber avoid Script by default.
[lilypond.git] / lily / lily-guile.cc
index 933bf271701959739cd5c9fcabbc8212e0a1ac0d..6035a91983303d6284e83d4660c4ada853ef7514 100644 (file)
@@ -527,6 +527,28 @@ robust_scm2double (SCM k, double x)
   return x;
 }
 
+vector<Real>
+ly_scm2floatvector (SCM l)
+{
+  vector<Real> floats;
+  for (SCM s = l; scm_is_pair (s); s = scm_cdr (s))
+    floats.push_back (robust_scm2double (scm_car (s), 0.0));
+  return floats;
+}
+
+SCM
+ly_floatvector2scm (vector<Real> v)
+{
+  SCM l = SCM_EOL;
+  SCM *tail = &l;
+  for (vsize i = 0; i < v.size (); i++)
+    {
+      *tail = scm_cons (scm_from_double (v[i]), SCM_EOL);
+      tail = SCM_CDRLOC (*tail);
+    }
+  return l;
+}
+
 string
 robust_scm2string (SCM k, string s)
 {
@@ -543,6 +565,18 @@ robust_scm2int (SCM k, int o)
   return o;
 }
 
+vsize
+robust_scm2vsize (SCM k, vsize o)
+{
+  if (scm_integer_p (k) == SCM_BOOL_T)
+    {
+      o = scm_to_int (k);
+      if (o >= 0)
+        return (vsize) o;
+    }
+  return o;
+}
+
 SCM
 ly_rational2scm (Rational r)
 {