X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Flily-guile.cc;h=ff3f7064bf62d4666d8cc4c8193ea6b2cc8b33af;hb=428508010fb07aa62249470e7d6f4dcb4db11541;hp=e9cf0909f28dca40a06930ed12f4eb599524d9fc;hpb=f8eebf9751f142cedcedb370b34b5cc2d0fc737c;p=lilypond.git diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index e9cf0909f2..ff3f7064bf 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -178,7 +178,7 @@ ly_scm_hash (SCM s) bool is_axis (SCM s) { - if (scm_is_integer (s)) + if (scm_is_number (s)) { int i = scm_to_int (s); return i == 0 || i == 1; @@ -212,7 +212,7 @@ robust_scm2dir (SCM d, Direction def) bool is_direction (SCM s) { - if (scm_is_integer (s)) + if (scm_is_number (s)) { int i = scm_to_int (s); return i >= -1 && i <= 1; @@ -226,10 +226,7 @@ is_direction (SCM s) Interval ly_scm2interval (SCM p) { - return is_number_pair (p) ? - Interval (scm_to_double (scm_car (p)), - scm_to_double (scm_cdr (p))) : - Interval (0, 0); + return Interval (scm_to_double (scm_car (p)), scm_to_double (scm_cdr (p))); } Drul_array @@ -287,10 +284,8 @@ ly_offset2scm (Offset o) Offset ly_scm2offset (SCM s) { - return is_number_pair (s) ? - Offset (scm_to_double (scm_car (s)), - scm_to_double (scm_cdr (s))) : - Offset (0, 0); + return Offset (scm_to_double (scm_car (s)), + scm_to_double (scm_cdr (s))); } Offset @@ -325,19 +320,20 @@ ly_scm2offsets (SCM s) /* ALIST */ -// This one is used nowhere. + bool -ly_is_alist_equal (SCM a, SCM b) +alist_equal_p (SCM a, SCM b) { - if (!scm_is_pair (a) || !scm_is_pair (b)) - return false; - for (SCM s = a; scm_is_pair (s); s = scm_cdr (s)) + for (SCM s = a; + scm_is_pair (s); s = scm_cdr (s)) { SCM key = scm_caar (s); SCM val = scm_cdar (s); SCM l = scm_assoc (key, b); - if (scm_is_false (l) || !ly_is_equal (scm_cdr (l), val)) + if (l == SCM_BOOL_F + || !ly_is_equal (scm_cdr (l), val)) + return false; } return true;