--- /dev/null
+\version "2.19.0"
+\header {
+ texidoc="
+Header blocks may appear before and after the actual music in a score.
+"
+}
+
+\markup \vspace #3
+\markup { \bold Note: expect piece and opus. }
+\markup \vspace #3
+
+\score {
+ \header {
+ piece = "Piece correct (set in score)"
+ opus = "Opus incorrect (to be superseded at score level)"
+ }
+ \new Staff { c'1 }
+ \header {
+ % This should NOT overwrite the piece from above!
+ opus = "Opus correct (superseded at score level)"
+ }
+}
}
;
+score_headers:
+ /* empty */
+ {
+ $$ = SCM_EOL;
+ }
+ | score_headers
+ {
+ if (!scm_is_pair ($1)
+ || !ly_is_module (scm_car ($1)))
+ $1 = scm_cons (ly_make_module (false), $1);
+ parser->lexer_->add_scope (scm_car ($1));
+ } lilypond_header
+ {
+ $$ = $1;
+ }
+ | score_headers output_def
+ {
+ Output_def *od = unsmob_output_def ($2);
+ if (od->lookup_variable (ly_symbol2scm ("is-paper")) == SCM_BOOL_T)
+ {
+ parser->parser_error (@2, _("\\paper cannot be used in \\score, use \\layout instead"));
+
+ }
+ else
+ {
+ if (scm_is_pair ($1) && ly_is_module (scm_car ($1)))
+ scm_set_cdr_x ($1, scm_cons ($2, scm_cdr ($1)));
+ else
+ $$ = scm_cons ($2, $1);
+ }
+ }
+ ;
+
+
+
score_body:
- music {
+ score_headers music {
SCM scorify = ly_lily_module_constant ("scorify-music");
- $$ = scm_call_2 (scorify, $1, parser->self_scm ());
+ $$ = scm_call_2 (scorify, $2, parser->self_scm ());
- unsmob_score ($$)->origin ()->set_spot (@$);
+ unsmob_score ($$)->origin ()->set_spot (@2);
+ if (scm_is_pair ($1) && ly_is_module (scm_car ($1)))
+ {
+ unsmob_score ($$)->set_header (scm_car ($1));
+ $1 = scm_cdr ($1);
+ }
+ for (SCM p = scm_reverse_x ($1, SCM_EOL);
+ scm_is_pair (p); p = scm_cdr (p))
+ {
+ unsmob_score ($$)->
+ add_output_def (unsmob_output_def (scm_car (p)));
+ }
}
| embedded_scm_active {
Score *score;