]> git.donarmstrong.com Git - lilypond.git/blob - lily/dimensions-scheme.cc
Web-ja: update introduction
[lilypond.git] / lily / dimensions-scheme.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "lily-guile.hh"
21 #include "dimensions.hh"
22 #include "warn.hh"
23
24 LY_DEFINE (ly_pt, "ly:pt",
25            1, 0, 0, (SCM num),
26            "@var{num} printer points.")
27 {
28   LY_ASSERT_TYPE (scm_is_number, num, 1);
29   return scm_from_double (point_constant
30                           * scm_to_double (num));
31 }
32
33 LY_DEFINE (ly_cm, "ly:cm",
34            1, 0, 0, (SCM num),
35            "@var{num} cm.")
36 {
37   LY_ASSERT_TYPE (scm_is_number, num, 1);
38   return scm_from_double (cm_constant
39                           * scm_to_double (num));
40 }
41
42 LY_DEFINE (ly_inch, "ly:inch",
43            1, 0, 0, (SCM num),
44            "@var{num} inches.")
45 {
46   LY_ASSERT_TYPE (scm_is_number, num, 1);
47   return scm_from_double (inch_constant
48                           * scm_to_double (num));
49 }
50
51 LY_DEFINE (ly_mm, "ly:mm",
52            1, 0, 0, (SCM num),
53            "@var{num} mm.")
54 {
55   LY_ASSERT_TYPE (scm_is_number, num, 1);
56   return scm_from_double (mm_constant
57                           * scm_to_double (num));
58 }
59
60 LY_DEFINE (ly_bp, "ly:bp",
61            1, 0, 0, (SCM num),
62            "@var{num} bigpoints (1/72th inch).")
63 {
64   LY_ASSERT_TYPE (scm_is_number, num, 1);
65   return scm_from_double (bigpoint_constant
66                           * scm_to_double (num));
67 }