2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1999--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
27 Spring::equal_p (SCM a, SCM b)
29 // TODO SCM: This could be made simpler.
30 return scm_is_eq (a, b) ? SCM_BOOL_T : SCM_BOOL_F;
33 LY_DEFINE (ly_make_spring, "ly:make-spring",
34 2, 0, 0, (SCM ideal, SCM min_dist),
35 "Make a spring. @var{ideal} is the ideal distance of the"
36 " spring, and @var{min-dist} is the minimum distance.")
38 LY_ASSERT_TYPE (scm_is_number, ideal, 1);
39 LY_ASSERT_TYPE (scm_is_number, min_dist, 2);
41 Spring s (scm_to_double (ideal), scm_to_double (min_dist));
43 return s.smobbed_copy ();
46 LY_DEFINE (ly_spring_set_inverse_compress_strength_x, "ly:spring-set-inverse-compress-strength!",
47 2, 0, 0, (SCM spring, SCM strength),
48 "Set the inverse compress @var{strength} of @var{spring}.")
50 LY_ASSERT_SMOB (Spring, spring, 1);
51 LY_ASSERT_TYPE (scm_is_number, strength, 2);
53 Spring *s = unsmob<Spring> (spring);
54 s->set_inverse_compress_strength (scm_to_double (strength));
55 return s->smobbed_copy ();
58 LY_DEFINE (ly_spring_set_inverse_stretch_strength_x, "ly:spring-set-inverse-stretch-strength!",
59 2, 0, 0, (SCM spring, SCM strength),
60 "Set the inverse stretch @var{strength} of @var{spring}.")
62 LY_ASSERT_SMOB (Spring, spring, 1);
63 LY_ASSERT_TYPE (scm_is_number, strength, 2);
65 Spring *s = unsmob<Spring> (spring);
66 s->set_inverse_stretch_strength (scm_to_double (strength));
67 return s->smobbed_copy ();
70 const char * const Spring::type_p_name_ = "ly:spring?";