]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-book-scheme.cc
9b3d1a45dde487df878a08213d37afe5f1e6b613
[lilypond.git] / lily / paper-book-scheme.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2005--2014 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 "paper-book.hh"
21 #include "ly-module.hh"
22 #include "output-def.hh"
23
24 LY_DEFINE (ly_paper_book_pages, "ly:paper-book-pages",
25            1, 0, 0, (SCM pb),
26            "Return pages in @code{Paper_book} object @var{pb}.")
27 {
28   LY_ASSERT_SMOB (Paper_book, pb, 1);
29   return unsmob_paper_book (pb)->pages ();
30 }
31
32 LY_DEFINE (ly_paper_book_scopes, "ly:paper-book-scopes",
33            1, 0, 0, (SCM pb),
34            "Return scopes in @code{Paper_book} object @var{pb}.")
35 {
36   LY_ASSERT_SMOB (Paper_book, pb, 1);
37   Paper_book *book = unsmob_paper_book (pb);
38
39   SCM scopes = SCM_EOL;
40   if (book->parent_)
41     {
42       scopes = ly_paper_book_scopes (book->parent_->self_scm ());
43     }
44   if (ly_is_module (book->header_))
45     scopes = scm_cons (book->header_, scopes);
46
47   return scopes;
48 }
49
50 LY_DEFINE (ly_paper_book_performances, "ly:paper-book-performances",
51            1, 0, 0, (SCM pb),
52            "Return performances in @code{Paper_book} object @var{pb}.")
53 {
54   LY_ASSERT_SMOB (Paper_book, pb, 1);
55   return unsmob_paper_book (pb)->performances ();
56 }
57
58 LY_DEFINE (ly_paper_book_systems, "ly:paper-book-systems",
59            1, 0, 0, (SCM pb),
60            "Return systems in @code{Paper_book} object @var{pb}.")
61 {
62   LY_ASSERT_SMOB (Paper_book, pb, 1);
63   return unsmob_paper_book (pb)->systems ();
64 }
65
66 LY_DEFINE (ly_paper_book_paper, "ly:paper-book-paper",
67            1, 0, 0, (SCM pb),
68            "Return the paper output definition (@code{\\paper})"
69            " in @code{Paper_book} object @var{pb}.")
70 {
71   LY_ASSERT_SMOB (Paper_book, pb, 1);
72   Paper_book *pbook = unsmob_paper_book (pb);
73   return pbook->paper_->self_scm ();
74 }
75
76 LY_DEFINE (ly_paper_book_header, "ly:paper-book-header",
77            1, 0, 0, (SCM pb),
78            "Return the header definition (@code{\\header})"
79            " in @code{Paper_book} object @var{pb}.")
80 {
81   LY_ASSERT_SMOB (Paper_book, pb, 1);
82   Paper_book *pbook = unsmob_paper_book (pb);
83   return pbook->header_;
84 }