Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / spanner-scheme.cc
blobd47e4f028509419217d888a2777f156204aa0c79
1 /*
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>
8 */
10 #include "spanner.hh"
11 #include "item.hh"
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));
33 SCM s = SCM_EOL;
34 for (vsize i = me->broken_intos_.size (); i--;)
35 s = scm_cons (me->broken_intos_[i]->self_scm (), s);
36 return s;
39 LY_DEFINE (ly_spanner_p, "ly:spanner?",
40 1, 0, 0, (SCM g),
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);