X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Ftranslator.hh;h=c84c109ec4fcdddb264287e43db8d0a8266aba5d;hb=ee513a2f7d18fc8d43e1c291350ed81856b0192d;hp=f3a96da1abb1c68225ca61c766bb9016aea643b9;hpb=615a9212789c2cb2994748c023d0e19f3a83a0fd;p=lilypond.git diff --git a/lily/include/translator.hh b/lily/include/translator.hh index f3a96da1ab..c84c109ec4 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -3,17 +3,19 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--2000 Han-Wen Nienhuys */ #ifndef TRANSLATOR_HH #define TRANSLATOR_HH +#include +#include "global-ctor.hh" #include "string.hh" #include "lily-proto.hh" #include "virtual-methods.hh" -#include "scalar.hh" +#include "lily-guile.hh" #include "dictionary.hh" #include "parray.hh" #include "input.hh" @@ -23,14 +25,12 @@ hierarchically grouped #Translator#s */ class Translator : public Input { - Dictionary properties_dict_; public: Music_output_def * output_def_l_; - String type_str_; - - bool is_alias_b (String) const; + String type_str_; - + virtual const char *name() const; + bool is_alias_b (String) const; VIRTUAL_COPY_CONS(Translator); Translator (Translator const &); @@ -54,19 +54,23 @@ public: void pre_move_processing(); void add_processing (); void creation_processing (); - void process_requests(); + void process_music(); void post_move_processing(); void removal_processing(); /** ask daddy for a feature */ - Scalar get_property (String type_str); - void set_property (String var_name, Scalar value); Music_output_def *output_def_l () const; + + SCM get_property (String) const; + SCM get_property (SCM symbol) const; - virtual Moment now_moment () const; + virtual Moment now_mom () const; protected: + /* + UGH. Clean this up. + */ enum { ORPHAN, VIRGIN, @@ -85,40 +89,29 @@ protected: virtual void do_add_processing (); virtual bool do_try_music (Music *req_l); virtual void do_print () const; - virtual void do_pre_move_processing(){} - virtual void do_post_move_processing(){} - virtual void do_process_requests () {} - virtual void do_creation_processing() {} - virtual void do_removal_processing() {} + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + virtual void do_process_music () ; + virtual void do_creation_processing() ; + virtual void do_removal_processing(); }; -template -class Translator_adder -{ -public: - static Translator *ctor () - { - T *t = new T; - t->type_str_ = classname (t); - return t; - } - Translator_adder () { - add_constructor (ctor); - } -}; - /** A macro to automate administration of translators. */ -#define ADD_THIS_TRANSLATOR(c) \ - Translator_adder _ ## c ## init; +#define ADD_THIS_TRANSLATOR(T) \ +static void _ ## T ## _adder () {\ + T *t = new T;\ + t->type_str_ = classname (t);\ + add_translator (t);\ +}\ +ADD_GLOBAL_CTOR(_ ## T ## _adder); + -typedef Translator *(*Translator_ctor) (); extern Dictionary *global_translator_dict_p; void add_translator (Translator*trans_p); -void add_constructor (Translator_ctor ctor); Translator*get_translator_l (String s);