}
SCM context = ly_run_translator (music, scaled_def, key);
- if (Global_context *g = dynamic_cast<Global_context *>
- (unsmob_context (context)))
+ Music_output *output = unsmob_music_output (ly_format_output (context));
+
+ if (Paper_score *pscore = dynamic_cast<Paper_score*> (output))
{
- SCM systems = ly_format_output (context, outname);
- Music_output *output = g->get_output ();
- if (systems != SCM_UNDEFINED)
- {
- /* ugh, this is strange, Paper_book without a Book object. */
- Paper_book *paper_book = new Paper_book ();
- paper_book->header_ = header;
- paper_book->paper_ = unsmob_output_def (scaled_bookdef);
+ /* ugh, this is strange, Paper_book without a Book object. */
+ Paper_book *paper_book = new Paper_book ();
+ paper_book->header_ = header;
+ paper_book->paper_ = unsmob_output_def (scaled_bookdef);
- if (ly_c_module_p (header))
- paper_book->add_score (header);
- paper_book->add_score (systems);
+ if (ly_c_module_p (header))
+ paper_book->add_score (header);
- paper_book->classic_output (ly_scm2string (outname));
- scm_gc_unprotect_object (paper_book->self_scm ());
- }
- delete output;
+ SCM systems = pscore->get_paper_systems ();
+ paper_book->add_score (systems);
+
+ paper_book->classic_output (ly_scm2string (outname));
+ scm_gc_unprotect_object (paper_book->self_scm ());
}
+ scm_gc_unprotect_object (output->self_scm ());
scm_remember_upto_here_1 (scaled_def);
scm_remember_upto_here_1 (scaled_bookdef);
}
/*
- Format score, return systems. OUTNAME is still passed to create a midi
- file.
+ Format score, return list of Music_output objects.
LAYOUTBOOK should be scaled already.
*/
SCM
-Score::book_rendering (String outname,
- Output_def *layoutbook,
+Score::book_rendering (Output_def *layoutbook,
Output_def *default_def,
Object_key *book_key)
{
if (layoutbook && layoutbook->c_variable ("is-paper") == SCM_BOOL_T)
scale = scm_to_double (layoutbook->c_variable ("outputscale"));
- SCM out = scm_makfrom0str (outname.to_str0 ());
- SCM systems = SCM_EOL;
+ SCM outputs = SCM_EOL;
+ SCM *tail = &outputs;
+
int outdef_count = defs_.size ();
Object_key *key = new Lilypond_general_key (book_key, user_key_, 0);
{
Output_def *def = outdef_count ? defs_[i] : default_def;
SCM scaled = SCM_EOL;
+
if (def->c_variable ("is-layout") == SCM_BOOL_T)
{
def = scale_output_def (def, scale);
SCM context = ly_run_translator (music_, def->self_scm (), scm_key);
if (dynamic_cast<Global_context *> (unsmob_context (context)))
{
- SCM s = ly_format_output (context, out);
- if (s != SCM_UNDEFINED)
- systems = s;
+ SCM s = ly_format_output (context);
+
+ *tail = scm_cons (s, SCM_EOL);
+ tail = SCM_CDRLOC(*tail);
}
scm_remember_upto_here_1 (scaled);
scm_remember_upto_here_1 (scm_key);
scm_remember_upto_here_1 (scaled_bookdef);
- return systems;
+ return outputs;
}
void
if (unsmob_music (music_))
{
- unsmob_music (music)->origin ()->error (_ ("Already have music in score"));
- unsmob_music (music_)->origin ()->error (_ ("This is the previous music"));
+ unsmob_music (music)->origin ()->error (_ ("already have music in score"));
+ unsmob_music (music_)->origin ()->error (_ ("this is the previous music"));
}
Music *m = unsmob_music (music);
if (m && to_boolean (m->get_property ("error-found")))
{
- m->origin ()->error (_ ("Error found in this music expression. Ignoring it"));
+ m->origin ()->error (_ ("errors found, ignoring music expression"));
this->error_found_ = this->error_found_ || to_boolean (m->get_property ("error-found"));
}