]> git.donarmstrong.com Git - lilypond.git/blob - lily/dimensions.cc
6cdbf449d1554daed77f2b1a5079a5950724d7ee
[lilypond.git] / lily / dimensions.cc
1 /*
2   dimensions.cc --  implement Dimension handling
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #include "lily-guile.hh"
11 #include "dimensions.hh"
12 #include "warn.hh"
13
14 LY_DEFINE (ly_pt, "ly:pt",
15            1, 0, 0, (SCM num),
16            "@var{num} printer points")
17 {
18   SCM_ASSERT_TYPE(scm_is_number (num), num, SCM_ARG1, __FUNCTION__,
19                   "number");
20   return scm_from_double (point_constant
21                           * scm_to_double (num));
22 }
23
24 LY_DEFINE (ly_cm, "ly:cm",
25            1, 0, 0, (SCM num),
26            "@var{num} cm")
27 {
28   SCM_ASSERT_TYPE(scm_is_number (num), num, SCM_ARG1, __FUNCTION__,
29                   "number");
30   return scm_from_double (cm_constant
31                           * scm_to_double (num));
32 }
33
34 LY_DEFINE (ly_inch, "ly:inch",
35            1, 0, 0, (SCM num),
36            "@var{num} inches")
37 {
38   SCM_ASSERT_TYPE(scm_is_number (num), num, SCM_ARG1, __FUNCTION__,
39                   "number");
40   return scm_from_double (inch_constant
41                           * scm_to_double (num));
42 }
43
44 LY_DEFINE (ly_mm, "ly:mm",
45            1, 0, 0, (SCM num),
46            "@var{num} mm")
47 {
48   SCM_ASSERT_TYPE(scm_is_number (num), num, SCM_ARG1, __FUNCTION__,
49                   "number");
50   return scm_from_double (mm_constant
51                           * scm_to_double (num));
52 }
53
54 LY_DEFINE (ly_bp, "ly:bp",
55            1, 0, 0, (SCM num),
56            "@var{num} bigpoints (1/72th inch)")
57 {
58   SCM_ASSERT_TYPE(scm_is_number (num), num, SCM_ARG1, __FUNCTION__,
59                   "number");
60   return scm_from_double (bigpoint_constant
61                           * scm_to_double (num));
62 }