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>
12 #include "global-context.hh"
13 #include "ly-module.hh"
15 #include "music-iterator.hh"
16 #include "music-output.hh"
18 #include "output-def.hh"
19 #include "paper-book.hh"
24 #include "ly-smobs.icc"
31 assert (!scores_.size ());
39 IMPLEMENT_SMOBS (Book);
40 IMPLEMENT_DEFAULT_EQUAL_P (Book);
43 Book::mark_smob (SCM s)
45 Book *book = (Book*) SCM_CELL_WORD_1 (s);
46 int score_count = book->scores_.size ();
47 for (int i = 0; i < score_count; i++)
48 scm_gc_mark (book->scores_[i]->self_scm ());
51 scm_gc_mark (book->bookpaper_->self_scm ());
56 Book::print_smob (SCM, SCM p, scm_print_state*)
58 scm_puts ("#<Book>", p);
62 /* This function does not dump the output; outname is required eg. for
63 dumping header fields. */
65 Book::process (String outname, Output_def *default_def)
67 Paper_book *paper_book = new Paper_book ();
68 Real scale = ly_scm2double (bookpaper_->c_variable ("outputscale"));
70 Output_def * scaled_bookdef = scale_output_def (bookpaper_, scale);
72 paper_book->bookpaper_ = scaled_bookdef;
73 scm_gc_unprotect_object (scaled_bookdef->self_scm());
75 paper_book->header_ = header_;
77 int score_count = scores_.size ();
78 for (int i = 0; i < score_count; i++)
80 SCM systems = scores_[i]->book_rendering (outname,
81 paper_book->bookpaper_,
84 /* If the score is empty, generate no output. Should we
86 if (ly_c_pair_p (systems))
91 paper_book->score_lines_.push (sc);