]> git.donarmstrong.com Git - lilypond.git/commitdiff
Nested book parts: do not push $defaultpaper in $papers stack, use it separately
authorNicolas Sceaux <nicolas.sceaux@free.fr>
Wed, 29 Oct 2008 09:58:35 +0000 (10:58 +0100)
committerNicolas Sceaux <nicolas.sceaux@free.fr>
Wed, 29 Oct 2008 09:58:35 +0000 (10:58 +0100)
lily/include/lily-parser.hh
lily/lily-parser.cc
lily/parser.yy

index aa656213874ab13e0c685acdb9330a0d119527d0..c73f8f7991faedd86fd1d7243895dfa0c006fbf0 100644 (file)
@@ -74,7 +74,6 @@ SCM ly_parser_scorify (SCM, SCM);
 Output_def *get_layout (Lily_parser *parser);
 Output_def *get_midi (Lily_parser *parser);
 Output_def *get_paper (Lily_parser *parser);
-void init_papers (Lily_parser *parser, Output_def *default_paper);
 void stack_paper (Lily_parser *parser, Output_def *paper);
 void unstack_paper (Lily_parser *parser);
 void set_paper (Lily_parser *parser, Output_def *paper);
index a7816a154c6f88593c7df48461f1c25866486938..7e414916654ae9c3bc721637dc24b7bebeec0320 100644 (file)
@@ -221,26 +221,22 @@ get_midi (Lily_parser *parser)
   return layout;
 }
 
-/* Return a copy of the top of $papers stack */
+/* Return a copy of the top of $papers stack, or $defaultpaper if the
+ * stack is empty */
 Output_def *
 get_paper (Lily_parser *parser)
 {
   SCM papers = parser->lexer_->lookup_identifier ("$papers");
-  Output_def *layout = (papers == SCM_UNDEFINED || scm_is_null (papers)) ?
+  Output_def *layout = ((papers == SCM_UNDEFINED) || scm_is_null (papers)) ?
     0 : unsmob_output_def (scm_car (papers));
+  SCM default_paper = parser->lexer_->lookup_identifier ("$defaultpaper");
+  layout = layout ? layout : unsmob_output_def (default_paper);
+
   layout = layout ? dynamic_cast<Output_def *> (layout->clone ()) : new Output_def;
   layout->set_variable (ly_symbol2scm ("is-paper"), SCM_BOOL_T);
   return layout;
 }
 
-/* Initialize $papers stack with the default paper */
-void
-init_papers (Lily_parser *parser, Output_def *default_paper)
-{
-  parser->lexer_->set_identifier (ly_symbol2scm ("$papers"),
-                                  scm_list_1 (default_paper->self_scm ()));
-}
-
 /* Stack a paper on top of $papers */
 void
 stack_paper (Lily_parser *parser, Output_def *paper)
index f821cd7efeb83db30bce19d4b67ac062d1056e21..2e0887f954f806f2ee1ebedadf1a6b002d844a49 100644 (file)
@@ -508,10 +508,7 @@ toplevel_expression:
                Output_def * od = $1;
 
                if ($1->c_variable ("is-paper") == SCM_BOOL_T)
-               {
                        id = ly_symbol2scm ("$defaultpaper");
-                       init_papers (PARSER, od);
-               }
                else if ($1->c_variable ("is-midi") == SCM_BOOL_T)
                        id = ly_symbol2scm ("$defaultmidi");
                else if ($1->c_variable ("is-layout") == SCM_BOOL_T)