]> git.donarmstrong.com Git - lilypond.git/blob - lily/book-scheme.cc
new file.
[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   for (SCM s = scores; scm_is_pair (s); s = scm_cdr (s))
30     {
31       Score *score = unsmob_score (scm_car (s));
32       if (score)
33         book->scores_.push (score);
34     }
35   
36   SCM x = book->self_scm ();
37   scm_gc_unprotect_object (x);
38   return x;
39 }