Allow for nested contexts of any depth.
[lilypond.git] / lily / music-wrapper.cc
blob968c4447a7ab8c4f06129b2111e670f7a9968fc3
1 /*
2 music-wrapper.cc -- implement Music_wrapper
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "music-wrapper.hh"
11 #include "music.hh"
13 MAKE_SCHEME_CALLBACK (Music_wrapper, start_callback, 1);
14 SCM
15 Music_wrapper::start_callback (SCM m)
17 Music *me = unsmob_music (m);
18 Music *elt = unsmob_music (me->get_property ("element"));
19 if (elt)
20 return elt->start_mom ().smobbed_copy ();
21 else
22 return Moment ().smobbed_copy ();
25 MAKE_SCHEME_CALLBACK (Music_wrapper, length_callback, 1);
26 SCM
27 Music_wrapper::length_callback (SCM m)
29 Music *me = unsmob_music (m);
30 Music *elt = unsmob_music (me->get_property ("element"));
31 if (elt)
32 return elt->get_length ().smobbed_copy ();
33 else
34 return Moment (0).smobbed_copy ();