X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fthread-devnull-engraver.cc;h=8480139e6a6867e5a2a1909036cd7bbd85b4ff9d;hb=f390b03c03489ad550469328fcd50c4490121216;hp=4006c476a243d2f539bec3039a9abb135794fef5;hpb=195abf4ce5b2182155bf8a9f0e2022eeaa5b32c2;p=lilypond.git diff --git a/lily/thread-devnull-engraver.cc b/lily/thread-devnull-engraver.cc index 4006c476a2..8480139e6a 100644 --- a/lily/thread-devnull-engraver.cc +++ b/lily/thread-devnull-engraver.cc @@ -3,45 +3,62 @@ source file of the GNU LilyPond music typesetter - (c) 2000 Jan Nieuwenhuizen + (c) 2000--2003 Jan Nieuwenhuizen */ #include "engraver.hh" #include "item.hh" -#include "musical-request.hh" +#include "event.hh" #include "translator-group.hh" class Thread_devnull_engraver : public Engraver { public: - VIRTUAL_COPY_CONS (Translator); + TRANSLATOR_DECLARATIONS(Thread_devnull_engraver); protected: virtual void acknowledge_grob (Grob_info); }; -ADD_THIS_TRANSLATOR (Thread_devnull_engraver); + void Thread_devnull_engraver::acknowledge_grob (Grob_info i) { - /* - FIXME: coriolan-fix hack -- ff geen inspiratie - - We should have at least three modes: - - 1. Never -- do nothing - 2. Allways -- junk everythingallways - 3. Regular: junk according to two/unison/unisilence/soloADue - - but how shall we do that? - - Hmm, maybe just: threadDevNull = 'never|'allways|... - */ - if (!to_boolean (get_property ("disableDevNullThread")) - && daddy_trans_l_->id_str_.left_str (3) == "two" - && (to_boolean (get_property ("unison")) - || to_boolean (get_property ("unisilence"))) - && to_boolean (get_property ("soloADue"))) - i.elem_l_->suicide (); + SCM s = get_property ("devNullThread"); + +#if 0 + /* No need, next if will never be true */ + if (s == ly_symbol2scm ("never")) + return; +#endif + + if (s == ly_symbol2scm ("always") + || (s == SCM_EOL + && to_boolean (get_property ("soloADue")) + && ((daddy_trans_->id_string_.left_string (3) == "two" + && (to_boolean (get_property ("unison")) + || to_boolean (get_property ("unisilence")))) + + /* Maybe this should be optional? */ + || to_boolean (get_property ("othersolo"))))) + { + i.grob_->suicide (); + } } +Thread_devnull_engraver::Thread_devnull_engraver(){} + +ENTER_DESCRIPTION(Thread_devnull_engraver, +/* descr */ "Kill elements whenever we are Voice called `two' and either " +"unison, unisilence or soloADue is set.@footnote{On unix systems, the " +"file @file{/dev/null} is special device: anything written to it is " +"discarded.}. This engraver works closely together with the part " +"combiner. When the part combiner notices that two threads are " +"identical, it tells the @code{Thread_devnull_engraver} to discard " +"everything in the second thread. " +, +/* creats*/ "", +/* accepts */ "", +/* acks */ "grob-interface", +/* reads */ "", +/* write */ "");