]> git.donarmstrong.com Git - lilypond.git/commitdiff
Nested book parts: fix undefined reference problem with $papers stack
authorNicolas Sceaux <nicolas.sceaux@free.fr>
Sun, 16 Nov 2008 12:07:57 +0000 (13:07 +0100)
committerNicolas Sceaux <nicolas.sceaux@free.fr>
Sun, 16 Nov 2008 12:07:57 +0000 (13:07 +0100)
lily/include/lily-parser.hh
lily/lily-parser.cc
lily/parser.yy

index c73f8f7991faedd86fd1d7243895dfa0c006fbf0..d6d7a754b8294403c28909cd5d7fe32799e327ea 100644 (file)
@@ -74,8 +74,9 @@ 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 stack_paper (Lily_parser *parser, Output_def *paper);
-void unstack_paper (Lily_parser *parser);
+void init_papers (Lily_parser *parser);
+void push_paper (Lily_parser *parser, Output_def *paper);
+void pop_paper (Lily_parser *parser);
 void set_paper (Lily_parser *parser, Output_def *paper);
 SCM get_header (Lily_parser *parser);
 
index 7e414916654ae9c3bc721637dc24b7bebeec0320..c46224fbbc596d4de4123b0de2257dadcfa8f93d 100644 (file)
@@ -237,24 +237,31 @@ get_paper (Lily_parser *parser)
   return layout;
 }
 
-/* Stack a paper on top of $papers */
+/* Initialize (reset) the $papers stack */
 void
-stack_paper (Lily_parser *parser, Output_def *paper)
+init_papers (Lily_parser *parser)
+{
+  parser->lexer_->set_identifier (ly_symbol2scm ("$papers"), SCM_EOL);
+}
+
+/* Push a paper on top of $papers stack */
+void
+push_paper (Lily_parser *parser, Output_def *paper)
 {
   parser->lexer_->set_identifier (ly_symbol2scm ("$papers"),
                                   scm_cons (paper->self_scm (),
                                             parser->lexer_->lookup_identifier ("$papers")));
 }
 
-/* Unstack a paper from $papers */
+/* Pop a paper from $papers stack */
 void
-unstack_paper (Lily_parser *parser)
+pop_paper (Lily_parser *parser)
 {
   parser->lexer_->set_identifier (ly_symbol2scm ("$papers"),
                                   scm_cdr (parser->lexer_->lookup_identifier ("$papers")));
 }
 
-/* Change the paper on top of $papers */
+/* Change the paper on top of $papers stack */
 void
 set_paper (Lily_parser *parser, Output_def *paper)
 {
index 2e0887f954f806f2ee1ebedadf1a6b002d844a49..e8be753f09ecbb426976cc57414757b3e282cf1a 100644 (file)
@@ -654,7 +654,7 @@ context_def_spec_body:
 book_block:
        BOOK '{' book_body '}'  {
                $$ = $3;
-               unstack_paper (PARSER);
+               pop_paper (PARSER);
        }
        ;
 
@@ -664,10 +664,11 @@ book_block:
 book_body:
        {
                $$ = new Book;
+               init_papers (PARSER);
                $$->origin ()->set_spot (@$);
                $$->paper_ = dynamic_cast<Output_def*> (unsmob_output_def (PARSER->lexer_->lookup_identifier ("$defaultpaper"))->clone ());
                $$->paper_->unprotect ();
-               stack_paper (PARSER, $$->paper_);
+               push_paper (PARSER, $$->paper_);
                $$->header_ = PARSER->lexer_->lookup_identifier ("$defaultheader"); 
        }
        | BOOK_IDENTIFIER {