summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2016-07-02 10:08:42 +0200
committerDavid Kastrup <dak@gnu.org>2016-07-07 18:02:09 +0200
commit22799b630629f695044ea6e5ee0c79b429e962f3 (patch)
tree7cf143af3521d4c3725fb096b067ce3960d204a9
parent4c8d9ad293aa114e851a4523d863d3194b6fe18f (diff)
Issue 4912: Fix output definition use in \book and \bookpart
The only explicit output definition blocks allowed in \book and \bookpart blocks were paper blocks. Output definitions supplied with Scheme expressions were erroneously interpreted like global output definitions, accepting all output definition types and overriding the global defaults with them. Now the only output definitions accepted as Scheme expressions are paper blocks. As opposed to previously, they actually set the paper block of the respective book or bookpart.
-rw-r--r--lily/parser.yy31
1 files changed, 11 insertions, 20 deletions
diff --git a/lily/parser.yy b/lily/parser.yy
index f184c5acb2..52fe450b7d 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -976,16 +976,12 @@ book_body:
SCM proc = parser->lexer_->lookup_identifier ("book-score-handler");
scm_call_2 (proc, $1, $2);
} else if (Output_def *od = unsmob<Output_def> ($2)) {
- SCM id = SCM_EOL;
-
- if (to_boolean (od->c_variable ("is-paper")))
- id = ly_symbol2scm ("$defaultpaper");
- else if (to_boolean (od->c_variable ("is-midi")))
- id = ly_symbol2scm ("$defaultmidi");
- else if (to_boolean (od->c_variable ("is-layout")))
- id = ly_symbol2scm ("$defaultlayout");
-
- parser->lexer_->set_identifier (id, $2);
+ if (to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) {
+ unsmob<Book> ($1)->paper_ = od;
+ set_paper (parser, od);
+ } else {
+ parser->parser_error (@2, _ ("need \\paper for paper block"));
+ }
} else if (ly_is_module ($2))
{
ly_module_copy (unsmob<Book> ($1)->header_, $2);
@@ -1060,16 +1056,11 @@ bookpart_body:
SCM proc = parser->lexer_->lookup_identifier ("bookpart-score-handler");
scm_call_2 (proc, $1, $2);
} else if (Output_def *od = unsmob<Output_def> ($2)) {
- SCM id = SCM_EOL;
-
- if (to_boolean (od->c_variable ("is-paper")))
- id = ly_symbol2scm ("$defaultpaper");
- else if (to_boolean (od->c_variable ("is-midi")))
- id = ly_symbol2scm ("$defaultmidi");
- else if (to_boolean (od->c_variable ("is-layout")))
- id = ly_symbol2scm ("$defaultlayout");
-
- parser->lexer_->set_identifier (id, $2);
+ if (to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) {
+ unsmob<Book> ($1)->paper_ = od;
+ } else {
+ parser->parser_error (@2, _ ("need \\paper for paper block"));
+ }
} else if (ly_is_module ($2)) {
Book *book = unsmob<Book> ($1);
if (!ly_is_module (book->header_))