From: Nicolas Sceaux Date: Sun, 16 Nov 2008 12:07:57 +0000 (+0100) Subject: Nested book parts: fix undefined reference problem with $papers stack X-Git-Tag: release/2.11.65-1~51^2~2^2~3 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=c423fa1e62d3060b592ea9e56c841649b8504d8b;p=lilypond.git Nested book parts: fix undefined reference problem with $papers stack --- diff --git a/lily/include/lily-parser.hh b/lily/include/lily-parser.hh index c73f8f7991..d6d7a754b8 100644 --- a/lily/include/lily-parser.hh +++ b/lily/include/lily-parser.hh @@ -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); diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 7e41491665..c46224fbbc 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -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) { diff --git a/lily/parser.yy b/lily/parser.yy index 2e0887f954..e8be753f09 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -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 (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 {