2 staff-symbol-referencer-scheme.cc -- implement Staff_symbol_referencer bindings
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2006 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 Grob *g = unsmob_grob (sg);
19 SCM_ASSERT_TYPE (g, sg, SCM_ARG1, __FUNCTION__, "grob");
20 Real pos = Staff_symbol_referencer::get_position (g);
22 if (fabs (rint (pos) -pos) < 1e-6) // ugh.
23 return scm_from_int ((int) my_round (pos));
25 return scm_from_double (pos);