summaryrefslogtreecommitdiff
path: root/lily/paper-book-scheme.cc
blob: 01fa9da459b2f24a7b59d0cfe7fd52844c03b133 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
  This file is part of LilyPond, the GNU music typesetter.

  Copyright (C) 2005--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>

  LilyPond is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  LilyPond is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "paper-book.hh"
#include "output-def.hh"

LY_DEFINE (ly_paper_book_pages, "ly:paper-book-pages",
           1, 0, 0, (SCM pb),
           "Return pages in @code{Paper_book} object @var{pb}.")
{
  LY_ASSERT_SMOB (Paper_book, pb, 1);
  return unsmob<Paper_book> (pb)->pages ();
}

LY_DEFINE (ly_paper_book_scopes, "ly:paper-book-scopes",
           1, 0, 0, (SCM pb),
           "Return scopes in @code{Paper_book} object @var{pb}.")
{
  LY_ASSERT_SMOB (Paper_book, pb, 1);
  Paper_book *book = unsmob<Paper_book> (pb);

  SCM scopes = SCM_EOL;
  if (book->parent_)
    {
      scopes = ly_paper_book_scopes (book->parent_->self_scm ());
    }
  if (ly_is_module (book->header_))
    scopes = scm_cons (book->header_, scopes);

  return scopes;
}

LY_DEFINE (ly_paper_book_performances, "ly:paper-book-performances",
           1, 0, 0, (SCM pb),
           "Return performances in @code{Paper_book} object @var{pb}.")
{
  LY_ASSERT_SMOB (Paper_book, pb, 1);
  return unsmob<Paper_book> (pb)->performances ();
}

LY_DEFINE (ly_paper_book_systems, "ly:paper-book-systems",
           1, 0, 0, (SCM pb),
           "Return systems in @code{Paper_book} object @var{pb}.")
{
  LY_ASSERT_SMOB (Paper_book, pb, 1);
  return unsmob<Paper_book> (pb)->systems ();
}

LY_DEFINE (ly_paper_book_paper, "ly:paper-book-paper",
           1, 0, 0, (SCM pb),
           "Return the paper output definition (@code{\\paper})"
           " in @code{Paper_book} object @var{pb}.")
{
  LY_ASSERT_SMOB (Paper_book, pb, 1);
  Paper_book *pbook = unsmob<Paper_book> (pb);
  return pbook->paper_->self_scm ();
}

LY_DEFINE (ly_paper_book_header, "ly:paper-book-header",
           1, 0, 0, (SCM pb),
           "Return the header definition (@code{\\header})"
           " in @code{Paper_book} object @var{pb}.")
{
  LY_ASSERT_SMOB (Paper_book, pb, 1);
  Paper_book *pbook = unsmob<Paper_book> (pb);
  return pbook->header_;
}