From: David Kastrup Date: Sat, 29 Mar 2014 19:05:52 +0000 (+0100) Subject: Issue 3892/1: Allow output defs as scheme expressions in toplevel, book, bookpart. X-Git-Tag: release/2.19.4-1~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=643daee48f829bcfa8e769a4518cd8cb788a3724;p=lilypond.git Issue 3892/1: Allow output defs as scheme expressions in toplevel, book, bookpart. --- diff --git a/lily/parser.yy b/lily/parser.yy index 8802f78769..54fe4745b3 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -448,6 +448,17 @@ toplevel_expression: { SCM proc = parser->lexer_->lookup_identifier ("toplevel-score-handler"); scm_call_2 (proc, parser->self_scm (), $1); + } else if (Output_def * od = unsmob_output_def ($1)) { + SCM id = SCM_EOL; + + if (od->c_variable ("is-paper") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultpaper"); + else if (od->c_variable ("is-midi") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultmidi"); + else if (od->c_variable ("is-layout") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultlayout"); + + parser->lexer_->set_identifier (id, $1); } else if (!scm_is_eq ($1, SCM_UNSPECIFIED)) parser->parser_error (@1, _("bad expression type")); } @@ -821,6 +832,17 @@ 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 (od->c_variable ("is-paper") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultpaper"); + else if (od->c_variable ("is-midi") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultmidi"); + else if (od->c_variable ("is-layout") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultlayout"); + + parser->lexer_->set_identifier (id, $2); } else if (!scm_is_eq ($2, SCM_UNSPECIFIED)) parser->parser_error (@2, _("bad expression type")); } @@ -891,6 +913,17 @@ 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 (od->c_variable ("is-paper") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultpaper"); + else if (od->c_variable ("is-midi") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultmidi"); + else if (od->c_variable ("is-layout") == SCM_BOOL_T) + id = ly_symbol2scm ("$defaultlayout"); + + parser->lexer_->set_identifier (id, $2); } else if (!scm_is_eq ($2, SCM_UNSPECIFIED)) parser->parser_error (@2, _("bad expression type")); }