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);
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)
{
book_block:
BOOK '{' book_body '}' {
$$ = $3;
- unstack_paper (PARSER);
+ pop_paper (PARSER);
}
;
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 {