]> git.donarmstrong.com Git - lilypond.git/blob - lily/book-scheme.cc
058be63a9ecea87bd5e682938270c32134cc8eda
[lilypond.git] / lily / book-scheme.cc
1 /*
2   book-scheme.cc -- implement Book bindings
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "book.hh"
10 #include "output-def.hh"
11 #include "score.hh"
12 #include "ly-module.hh"
13
14 LY_DEFINE(ly_make_book, "ly:make-book",
15           2, 0, 1, (SCM paper, SCM header, SCM scores),
16           "Make a \\book of @var{paper} and @var{header} (which may be #f as well)  "
17           "containing @code{\\scores}.")
18 {
19   Output_def * odef = unsmob_output_def (paper);
20   SCM_ASSERT_TYPE (odef, paper,
21                    SCM_ARG1, __FUNCTION__, "Output_def");
22
23   Book *book = new Book;
24   book->paper_ = odef;
25
26   if (ly_c_module_p (header))
27     book->header_ = header;
28
29   book->scores_ = scm_append (scm_list_2 (scores, book->scores_));
30
31   SCM x = book->self_scm ();
32   scm_gc_unprotect_object (x);
33   return x;
34 }