+ while (scm_is_pair (outputs))
+ {
+ Music_output *output = unsmob_music_output (scm_car (outputs));
+
+ if (Performance *perf = dynamic_cast<Performance *> (output))
+ output_paper_book->add_performance (perf->self_scm ());
+ else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
+ {
+ if (ly_is_module (score->get_header ()))
+ output_paper_book->add_score (score->get_header ());
+ output_paper_book->add_score (pscore->self_scm ());
+ }
+
+ outputs = scm_cdr (outputs);
+ }
+ }
+ else if (Text_interface::is_markup_list (scm_car (s))
+ || unsmob_page_marker (scm_car (s)))
+ output_paper_book->add_score (scm_car (s));
+ else
+ assert (0);
+
+}
+
+/* Concatenate all score or book part outputs into a Paper_book
+ */
+Paper_book *
+Book::process (Output_def *default_paper,
+ Output_def *default_layout,
+ Paper_book *parent_part)
+{
+ Output_def *paper = paper_ ? paper_ : default_paper;
+
+ /* If top book, recursively check score errors */
+ if (!parent_part && error_found ())
+ return 0;
+
+ if (!paper)
+ return 0;
+
+ Paper_book *paper_book = new Paper_book ();
+ Real scale = scm_to_double (paper->c_variable ("output-scale"));
+ Output_def *scaled_bookdef = scale_output_def (paper, scale);
+ paper_book->paper_ = scaled_bookdef;
+ if (parent_part)
+ {
+ paper_book->parent_ = parent_part;
+ paper_book->paper_->parent_ = parent_part->paper_;
+ }