* lily/paper-def.cc (smobbed_copy): New method.
2004-03-09 Jan Nieuwenhuizen <janneke@gnu.org>
+ * lily/score.cc (default_rendering): Protect paper-book members.
+
+ * lily/paper-def.cc (smobbed_copy): New method.
+
* lily/include/paper-book.hh (PAGE_LAYOUT): Define as "ps"; make
switch runtime.
#include "lily-guile.hh"
#include "parray.hh"
#include "protected-scm.hh"
+#include "smobs.hh"
#define PAGE_LAYOUT "ps"
class Paper_book
{
public:
+ Protected_scm protect_;
Array<SCM> headers_;
+ Array<SCM> global_headers_;
Link_array<Paper_def> papers_;
Array<SCM> scores_;
Stencil* get_title (int);
void output (String);
void classic_output (String);
+
+ SCM smobbed_copy () const;
+
+private:
+ DECLARE_SIMPLE_SMOBS (Paper_book, )
};
+DECLARE_UNSMOB (Paper_book, paper_book)
+
#endif /* PAPER_BOOK_HH */
VIRTUAL_COPY_CONSTRUCTOR (Music_output_def, Paper_def);
public:
- Paper_outputter* get_paper_outputter (String) const;
-
- SCM font_descriptions ()const;
- virtual ~Paper_def ();
static int score_count_;
- /*
- JUNKME
- */
- Real get_realvar (SCM symbol) const;
- void reinit ();
Paper_def ();
Paper_def (Paper_def const&);
-
+ virtual ~Paper_def ();
+
+ Paper_outputter* get_paper_outputter (String) const;
+ SCM font_descriptions () const;
+ void reinit ();
Interval line_dimensions_int (int) const;
-
void output_settings (Paper_outputter*) const;
-
- Font_metric * find_font (SCM name, Real mag);
+ Font_metric *find_font (SCM name, Real mag);
+
+ /* JUNKME */
+ Real get_realvar (SCM symbol) const;
+
+ SCM smobbed_copy () const;
- // urg
friend int yyparse (void*);
};
Paper_def * unsmob_paper (SCM x);
Font_metric *select_font (Paper_def *paper, SCM chain);
-#endif // Paper_def_HH
+#endif /* PAPER_DEF_HH */
if (header_)
header_ = SCM_EOL;
- global_input_file =0;
+ global_input_file = 0;
ly_clear_anonymous_modules ();
}
String s (YYText ()+1);
s = s.left_string (s.index_last ('"'));
- new_input (s, &global_input_file->sources_ );
+ new_input (s, &global_input_file->sources_);
yy_pop_state ();
}
<incl>\\{BLACK}*;?{WHITE} { /* got the include identifier */
#include <stdio.h>
-#include "input-file-results.hh"
#include "ly-module.hh"
#include "main.hh"
#include "paper-book.hh"
Paper_book::Paper_book ()
{
+ protect_ = SCM_EOL;
}
void
SCM scopes = SCM_EOL;
if (headers_[i])
scopes = scm_cons (headers_[i], scopes);
- if (global_input_file->header_ && global_input_file->header_ != headers_[i])
- scopes = scm_cons (global_input_file->header_, scopes);
+ if (global_headers_[i] && global_headers_[i] != headers_[i])
+ scopes = scm_cons (global_headers_[i], scopes);
return scopes;
}
out->output_scheme (scm_list_1 (ly_symbol2scm ("end-output")));
progress_indication ("\n");
}
+
+
+#include "ly-smobs.icc"
+
+IMPLEMENT_DEFAULT_EQUAL_P (Paper_book);
+IMPLEMENT_SIMPLE_SMOBS (Paper_book)
+IMPLEMENT_TYPE_P (Paper_book, "ly:paper_book?")
+
+SCM
+Paper_book::mark_smob (SCM)
+{
+ return SCM_EOL;
+}
+
+int
+Paper_book::print_smob (SCM smob, SCM port, scm_print_state*)
+{
+ Paper_book *b = (Paper_book*) ly_cdr (smob);
+
+ scm_puts ("#<", port);
+ scm_puts (classname (b), port);
+ scm_puts (" ", port);
+ //scm_puts (b->, port);
+ scm_puts (">", port);
+ return 1;
+}
+
+SCM
+Paper_book::smobbed_copy () const
+{
+ Paper_book *b = new Paper_book (*this);
+ return b->smobbed_self ();
+}
return dynamic_cast<Paper_def*> (unsmob_music_output_def (x));
}
+SCM
+Paper_def::smobbed_copy () const
+{
+ Paper_def *p = new Paper_def (*this);
+ return p->smobbed_self ();
+}
lilypond_header:
HEADER '{' lilypond_header_body '}' {
- $$ = THIS->lexer_-> remove_scope ();
+ $$ = THIS->lexer_->remove_scope ();
}
;
#include "ly-module.hh"
#include "paper-book.hh"
#include "paper-score.hh"
+#include "input-file-results.hh"
/*
Music_output *output = g->get_output ();
if (systems != SCM_UNDEFINED)
{
- paper_book->scores_.push (systems);
- paper_book->headers_.push (header);
Paper_score *ps = dynamic_cast<Paper_score*> (output);
+ // Hmmr
+ paper_book->protect_ = scm_cons (systems, paper_book->protect_);
+ paper_book->protect_ = scm_cons (global_input_file->header_,
+ paper_book->protect_);
+ paper_book->protect_ = scm_cons (header, paper_book->protect_);
+ paper_book->protect_ = scm_cons (ps->paper_->smobbed_copy (),
+ paper_book->protect_);
+
paper_book->papers_.push (ps->paper_);
+ paper_book->scores_.push (systems);
+ paper_book->global_headers_.push (global_input_file->header_);
+ paper_book->headers_.push (header);
if (output_format_global != PAGE_LAYOUT)
paper_book->classic_output (ly_scm2string (outname));
}
(begin
(ly:warn
(format "Programming error: No such font: ~S" name-mag-pair))
+ (write font-name-alist)
""))))
(string-append (select-font name-mag-pair) exp))