+ Lily_parser *parser = unsmob_my_lily_parser (parser_smob);
+ Score *score = unsmob_score (score_smob);
+
+ SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG1, __FUNCTION__, "parser");
+ SCM_ASSERT_TYPE (score, score_smob, SCM_ARG2, __FUNCTION__, "score");
+
+ SCM header = ly_c_module_p (score->header_) ? score->header_
+ : parser->lexer_->lookup_identifier ("$globalheader");
+
+ File_name outname (parser->output_basename_);
+ int *c = &parser->book_count_;
+ if (*c)
+ outname.base_ += "-" + to_string (*c);
+ (*c)++;
+
+ SCM os = scm_makfrom0str (outname.to_string ().to_str0 ());
+ SCM bookpaper = get_bookpaper (parser)->self_scm ();
+ for (int i = 0; i < score->defs_.size (); i++)
+ default_rendering (score->music_, score->defs_[i]->self_scm (),
+ bookpaper,
+ header, os);
+
+ if (score->defs_.is_empty ())
+ {
+ Output_def *paper = get_paper (parser);
+ default_rendering (score->music_, paper->self_scm (),
+ get_bookpaper (parser)->self_scm (),
+ header, os);
+ scm_gc_unprotect_object (paper->self_scm ());
+ }
+ return SCM_UNSPECIFIED;
+}
+
+
+LY_DEFINE (ly_parser_set_note_names, "ly:parser-set-note-names",
+ 2, 0, 0, (SCM parser, SCM names),
+ "Replace current note names in @var{parser}. "
+ "@var{names} is an alist of symbols. "
+ "This only has effect if the current mode is notes.")
+{
+ Lily_parser *p = unsmob_my_lily_parser (parser);
+ SCM_ASSERT_TYPE(p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
+
+ if (p->lexer_->is_note_state ())
+ {
+ p->lexer_->pop_state ();
+ p->lexer_->push_note_state (alist_to_hashq (names));
+ }
+
+ return SCM_UNSPECIFIED;