2 book-scheme.cc -- implement Book bindings
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2007 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 LY_ASSERT_SMOB (Output_def, paper, 1);
24 Book *book = new Book;
27 if (ly_is_module (header))
28 book->header_ = header;
30 book->scores_ = scm_append (scm_list_2 (scores, book->scores_));
32 SCM x = book->self_scm ();
37 LY_DEFINE (ly_book_process, "ly:book-process",
38 4, 0, 0, (SCM book_smob,
42 "Print book. @var{output} is passed to the backend unchanged. "
44 "a string (for file based outputs) or a socket (for network based "
47 Book *book = unsmob_book (book_smob);
49 LY_ASSERT_SMOB(Book, book_smob, 1);
50 LY_ASSERT_SMOB(Output_def, default_paper, 2);
51 LY_ASSERT_SMOB(Output_def, default_layout, 3);
53 Paper_book *pb = book->process (unsmob_output_def (default_paper),
54 unsmob_output_def (default_layout));
61 return SCM_UNSPECIFIED;
65 LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems",
66 4, 0, 0, (SCM book_smob,
70 "Print book. @var{output} is passed to the backend unchanged. "
72 "a string (for file based outputs) or a socket (for network based "
75 LY_ASSERT_SMOB (Book, book_smob, 1);
76 LY_ASSERT_SMOB(Output_def, default_paper, 2);
77 LY_ASSERT_SMOB(Output_def, default_layout, 3);
79 Book *book = unsmob_book (book_smob);
81 Paper_book *pb = book->process (unsmob_output_def (default_paper),
82 unsmob_output_def (default_layout));
85 pb->classic_output (output);
89 return SCM_UNSPECIFIED;