2 staff-symbol-referencer-scheme.cc -- implement Staff_symbol_referencer bindings
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "staff-symbol-referencer.hh"
11 #include "libc-extension.hh"
13 LY_DEFINE (ly_grob_staff_position
, "ly:grob-staff-position",
15 "Return the Y-position of @var{sg} relative to the staff.")
17 LY_ASSERT_SMOB (Grob
, sg
, 1);
18 Grob
*g
= unsmob_grob (sg
);
19 Real pos
= Staff_symbol_referencer::get_position (g
);
21 if (fabs (rint (pos
) -pos
) < 1e-6) // ugh.
22 return scm_from_int ((int) my_round (pos
));
24 return scm_from_double (pos
);