diff options
author | Valentin Villenave <valentin@villenave.net> | 2015-04-21 17:57:03 +0200 |
---|---|---|
committer | Valentin Villenave <valentin@villenave.net> | 2015-04-21 17:57:03 +0200 |
commit | e0af94bb8939bc6f4998db6294010baa77139092 (patch) | |
tree | a70e48317413af4ce8026b444ceab8ff9c579657 /lily/simple-spacer-scheme.cc | |
parent | 237343567335e54017c40545dc2e20fb3eca50fa (diff) |
Replace C++ (in)equality checks with proper SCM syntax
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).
Diffstat (limited to 'lily/simple-spacer-scheme.cc')
-rw-r--r-- | lily/simple-spacer-scheme.cc | 2 |
1 files changed, 1 insertions, 1 deletions
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)) { |