2 book.cc -- implement Book
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "ly-smobs.icc"
14 #include "global-context.hh"
15 #include "ly-module.hh"
16 #include "input-file-results.hh"
18 #include "music-iterator.hh"
19 #include "music-output-def.hh"
20 #include "music-output.hh"
22 #include "paper-book.hh"
23 #include "paper-def.hh"
35 Book::Book (Book const &src)
41 int score_count = src.scores_.size ();
42 for (int i = 0; i < score_count; i++)
43 scores_.push (src.scores_[i]->clone ());
46 header_ = ly_make_anonymous_module ();
47 if (is_module (src.header_))
48 ly_import_module (header_, src.header_);
57 IMPLEMENT_SMOBS (Book);
58 IMPLEMENT_DEFAULT_EQUAL_P (Book);
61 Book::mark_smob (SCM s)
63 Book *book = (Book*) SCM_CELL_WORD_1 (s);
64 int score_count = book->scores_.size ();
65 for (int i = 0; i < score_count; i++)
66 scm_gc_mark (book->scores_[i]->self_scm ());
71 Book::print_smob (SCM, SCM p, scm_print_state*)
73 scm_puts ("#<Book>", p);
78 Book::process (String outname, Music_output_def *default_def, SCM header)
80 Paper_book *paper_book = new Paper_book ();
81 int score_count = scores_.size ();
82 for (int i = 0; i < score_count; i++)
85 SCM systems = scores_[i]->book_rendering (outname, default_def, &paper);
86 if (systems != SCM_UNDEFINED)
89 paper_book->papers_.push (paper);
90 paper_book->scores_.push (systems);
91 paper_book->global_headers_.push (global_input_file->header_);
92 //paper_book->headers_.push (scores_[i]->header_);
93 paper_book->headers_.push (header);
96 paper_book->output (outname);
97 scm_gc_unprotect_object (paper_book->self_scm ());