X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fglobal-translator.cc;h=dc6280681157dbd899191c58c4f98503f94c31b3;hb=7e72a1e50e94a7f9738d62599de79fe7745f600c;hp=0c079c40d223d89d80c7cde2e8de5818f6ef7446;hpb=a6ee9dcd388111e842064a8d46ab06c4897a00d2;p=lilypond.git diff --git a/lily/global-translator.cc b/lily/global-translator.cc index 0c079c40d2..dc62806811 100644 --- a/lily/global-translator.cc +++ b/lily/global-translator.cc @@ -3,13 +3,13 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2002 Han-Wen Nienhuys + (c) 1997--2004 Han-Wen Nienhuys */ #include #include "warn.hh" #include "music.hh" -#include "request.hh" +#include "event.hh" #include "music-list.hh" #include "music-iterator.hh" #include "global-translator.hh" @@ -72,6 +72,7 @@ void Global_translator::one_time_step () { } + void Global_translator::start () { @@ -98,11 +99,11 @@ Global_translator::run_iterator_on_me (Music_iterator * iter) } w = sneaky_insert_extra_moment (w); + if (w.main_part_.is_infinity ()) + break ; - // printf ("proccing %s\n ", w.string ().to_str0 ()); - - + // printf ("proccing %s\n ", w.to_string ().to_str0 ()); if (first) { first = false; @@ -116,3 +117,39 @@ Global_translator::run_iterator_on_me (Music_iterator * iter) one_time_step (); } } + +void +Global_translator::apply_finalizations () +{ + SCM lst = get_property ("finalizations"); + set_property ("finalizations" , SCM_EOL); + for (SCM s = lst ; gh_pair_p (s); s = gh_cdr (s)) + { + scm_primitive_eval (gh_car (s)); + } +} + +/* + Add a function to execute before stepping to the next time step. + */ +void +Global_translator::add_finalization (SCM x) +{ + SCM lst = get_property ("finalizations"); + lst = scm_cons (x, lst); + set_property ("finalizations" ,lst); +} + + +Global_translator * +Translator::top_translator()const +{ + if (dynamic_cast((Translator*)this)) + return dynamic_cast ((Translator*)this); + + if (daddy_trans_) + return daddy_trans_->top_translator (); + + programming_error ("No top translator!"); + return 0; +}