-int
-Paper_book::print_smob (SCM smob, SCM port, scm_print_state*)
-{
- Paper_book *b = (Paper_book*) ly_cdr (smob);
-
- scm_puts ("#<", port);
- scm_puts (classname (b), port);
- scm_puts (" ", port);
- //scm_puts (b->, port);
- scm_puts (">", port);
- return 1;
+ SCM page_properties
+ = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
+ paper_->self_scm ());
+
+ SCM header = SCM_EOL;
+ for (SCM s = scm_reverse (scores_); s != SCM_EOL; s = scm_cdr (s))
+ {
+ if (ly_c_module_p (scm_car (s)))
+ {
+ header = scm_car (s);
+ if (header_0_ == SCM_EOL)
+ header_0_ = header;
+ }
+ else if (Music_output *mop = unsmob_music_output (scm_car (s)))
+
+ {
+ if (Paper_score *pscore = dynamic_cast<Paper_score *> (mop))
+ {
+ add_score_title (header);
+
+ header = SCM_EOL;
+
+ SCM system_list = scm_vector_to_list (pscore->get_paper_systems ());
+ system_list = scm_reverse (system_list);
+ systems_ = scm_append (scm_list_2 (system_list, systems_));
+ }
+ else
+ {
+ /*
+ Ignore MIDI
+ */
+ }
+ }
+ else if (scm_is_vector (scm_car (s)))
+ {
+ /*
+ UGH. code dup.
+ */
+ add_score_title (header);
+ header = SCM_EOL;
+
+ SCM system_list = scm_vector_to_list (scm_car (s));
+ system_list = scm_reverse (system_list);
+ systems_ = scm_append (scm_list_2 (system_list, systems_));
+ }
+ else if (Text_interface::markup_p (scm_car (s)))
+ {
+ SCM t = Text_interface::interpret_markup (paper_->self_scm (),
+ page_properties,
+ scm_car (s));
+ // FIXME: title=true?
+ Paper_system *ps = new Paper_system (*unsmob_stencil (t), true);
+ systems_ = scm_cons (ps->self_scm (), systems_);
+ scm_gc_unprotect_object (ps->self_scm ());
+ // FIXME: figure out penalty.
+ //set_system_penalty (ps, scores_[i].header_);
+ }
+ else
+ assert (0);
+ }
+
+ systems_ = scm_reverse (systems_);
+
+ int i = 0;
+ Paper_system *last = 0;
+ for (SCM s = systems_; s != SCM_EOL; s = scm_cdr (s))
+ {
+ Paper_system *ps = unsmob_paper_system (scm_car (s));
+ ps->number_ = ++i;
+
+ if (last
+ && last->is_title ()
+ && !ps->break_before_penalty_)
+ ps->break_before_penalty_ = 10000;
+ last = ps;
+ }
+
+ return systems_;