+/* Initialize (reset) the $papers stack */
+void
+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")));
+}
+
+/* Pop a paper from $papers stack */
+void
+pop_paper (Lily_parser *parser)
+{
+ if (! scm_is_null (parser->lexer_->lookup_identifier ("$papers")))
+ parser->lexer_->set_identifier (ly_symbol2scm ("$papers"),
+ scm_cdr (parser->lexer_->lookup_identifier ("$papers")));
+}
+
+/* Change the paper on top of $papers stack */
+void
+set_paper (Lily_parser *parser, Output_def *paper)
+{
+ scm_set_car_x (parser->lexer_->lookup_identifier ("$papers"), paper->self_scm ());
+}
+