Use `transform'.
[lilypond.git] / lily / staff-symbol-referencer-scheme.cc
blob8e0094f143d29abc7f56e8db760e161f934e9f23
1 /*
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>
7 */
9 #include "grob.hh"
10 #include "staff-symbol-referencer.hh"
11 #include "libc-extension.hh"
13 LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position",
14 1, 0, 0, (SCM sg),
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));
23 else
24 return scm_from_double (pos);