2 spanner-scheme.cc -- implement Spanner bindings.
4 source file of the GNU LilyPond music typesetter
6 (c) 2007--2009 Han-Wen Nienhuys <hanwen@lilypond.org>
13 LY_DEFINE (ly_spanner_bound
, "ly:spanner-bound",
14 2, 0, 0, (SCM spanner
, SCM dir
),
15 "Get one of the bounds of @var{spanner}. @var{dir} is @code{-1}"
16 " for left, and @code{1} for right.")
18 LY_ASSERT_TYPE (unsmob_spanner
, spanner
, 1);
19 LY_ASSERT_TYPE (is_direction
, dir
, 2);
21 return unsmob_spanner (spanner
)->get_bound (to_dir (dir
))->self_scm ();
24 /* TODO: maybe we should return a vector -- random access is more
25 logical for this list? */
26 LY_DEFINE (ly_spanner_broken_into
, "ly:spanner-broken-into",
27 1, 0, 0, (SCM spanner
),
28 "Return broken-into list for @var{spanner}.")
30 LY_ASSERT_TYPE (unsmob_spanner
, spanner
, 1);
31 Spanner
*me
= dynamic_cast<Spanner
*> (unsmob_grob (spanner
));
34 for (vsize i
= me
->broken_intos_
.size (); i
--;)
35 s
= scm_cons (me
->broken_intos_
[i
]->self_scm (), s
);
39 LY_DEFINE (ly_spanner_p
, "ly:spanner?",
41 "Is @var{g} a spanner object?")
43 Grob
*me
= unsmob_grob (g
);
44 bool b
= dynamic_cast<Spanner
*> (me
);
46 return ly_bool2scm (b
);