From e0af94bb8939bc6f4998db6294010baa77139092 Mon Sep 17 00:00:00 2001 From: Valentin Villenave Date: Tue, 21 Apr 2015 17:57:03 +0200 Subject: Replace C++ (in)equality checks with proper SCM syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit replaces the most straightforward situations where two SCM objects are compared. Here are the basic replacements used: x == y -------> scm_is_eq (x,y) x == SCM_BOOL_T -------> to_boolean (x) x == SCM_BOOL_F -------> scm_is_false (x) x != SCM_BOOL_T -------> scm_is_true (x) x == SCM_UNDEFINED -------> SCM_UNBNDP (x) x == SCM_EOL -------> scm_is_null (x) (scm_exact_p (x) == SCM_BOOL_T) -------> ly_is_rational (x) (scm_integer_p (x) == SCM_BOOL_T) -------> scm_is_integer (x) (scm_list_p (x) == SCM_BOOL_T) -------> ly_is_list (x) (scm_port_p (x) == SCM_BOOL_T) -------> ly_is_port (x) (scm_equal_p (x, y) == SCM_BOOL_T) -------> ly_is_equal (x,y) Finally, I replaced (!cached) with (!SCM_UNPACK (cached)) in lily-guile-macros.hh, as has been suggested once by David. Please note that this commit does not handle some situations I’m less comfortable with (namely those involving scm_c_memq, scm_assq or scm_hashq_get_handle), and some scm_*_p checks for which there isn’t a ly_is_* replacement yet (to wit, scm_hash_table_p, scm_promise_p, and scm_variable_bound_p). Those should be dealt with later (another patch is in the works). --- lily/simple-spacer-scheme.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lily/simple-spacer-scheme.cc') diff --git a/lily/simple-spacer-scheme.cc b/lily/simple-spacer-scheme.cc index cc09da1021..7c1c866c61 100644 --- a/lily/simple-spacer-scheme.cc +++ b/lily/simple-spacer-scheme.cc @@ -48,7 +48,7 @@ LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods"); LY_ASSERT_TYPE (scm_is_number, length, 3); - bool is_ragged = ragged == SCM_BOOL_T; + bool is_ragged = to_boolean (ragged); Simple_spacer spacer; for (SCM s = springs; scm_is_pair (s); s = scm_cdr (s)) { -- cgit v1.2.3