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_FIRST_SMOB (Output_def, paper)
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_FUNC_NOTE_FIRST_ARG(book_smob);
50 LY_ASSERT_SMOB(Book,1);
51 LY_ASSERT_SMOB(Output_def, 2);
52 LY_ASSERT_SMOB(Output_def, 3);
54 Paper_book *pb = book->process (unsmob_output_def (default_paper),
55 unsmob_output_def (default_layout));
62 return SCM_UNSPECIFIED;
66 LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems",
67 4, 0, 0, (SCM book_smob,
71 "Print book. @var{output} is passed to the backend unchanged. "
73 "a string (for file based outputs) or a socket (for network based "
76 Book *book = unsmob_book (book_smob);
78 LY_FUNC_NOTE_FIRST_ARG(book_smob);
80 LY_ASSERT_SMOB(Book,1);
81 LY_ASSERT_SMOB(Output_def, 2);
82 LY_ASSERT_SMOB(Output_def, 3);
84 Paper_book *pb = book->process (unsmob_output_def (default_paper),
85 unsmob_output_def (default_layout));
88 pb->classic_output (output);
92 return SCM_UNSPECIFIED;