2 book-scheme.cc -- implement Book bindings
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "output-def.hh"
13 #include "paper-book.hh"
14 #include "ly-module.hh"
16 LY_DEFINE (ly_make_book
, "ly:make-book",
17 2, 0, 1, (SCM paper
, SCM header
, SCM scores
),
18 "Make a \\book of @var{paper} and @var{header} (which may be #f as well) "
19 "containing @code{\\scores}.")
21 Output_def
*odef
= unsmob_output_def (paper
);
22 SCM_ASSERT_TYPE (odef
, paper
,
23 SCM_ARG1
, __FUNCTION__
, "Output_def");
25 Book
*book
= new Book
;
28 if (ly_is_module (header
))
29 book
->header_
= header
;
31 book
->scores_
= scm_append (scm_list_2 (scores
, book
->scores_
));
33 SCM x
= book
->self_scm ();
38 LY_DEFINE (ly_parser_print_book
, "ly:book-process",
39 4, 0, 0, (SCM book_smob
,
43 "Print book. @var{output} is passed to the backend unchanged. "
45 "a string (for file based outputs) or a socket (for network based "
48 Book
*book
= unsmob_book (book_smob
);
50 SCM_ASSERT_TYPE (book
, book_smob
, SCM_ARG1
, __FUNCTION__
, "Book");
51 SCM_ASSERT_TYPE (unsmob_output_def (default_paper
),
52 default_layout
, SCM_ARG2
, __FUNCTION__
, "\\paper block");
53 SCM_ASSERT_TYPE (unsmob_output_def (default_layout
),
54 default_layout
, SCM_ARG3
, __FUNCTION__
, "\\layout block");
56 Paper_book
*pb
= book
->process (unsmob_output_def (default_paper
),
57 unsmob_output_def (default_layout
));
64 return SCM_UNSPECIFIED
;