]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3892/1: Allow output defs as scheme expressions in toplevel, book, bookpart.
authorDavid Kastrup <dak@gnu.org>
Sat, 29 Mar 2014 19:05:52 +0000 (20:05 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 4 Apr 2014 09:15:38 +0000 (11:15 +0200)
lily/parser.yy

index 8802f7876956b8c320a56c8dcc372f58c122acfb..54fe4745b3455e430a534b59e5195d774c47579c 100644 (file)
@@ -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"));
        }