2 translator.hh -- declare Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #include "global-ctor.hh"
15 #include "lily-proto.hh"
16 #include "virtual-methods.hh"
17 #include "lily-guile.hh"
21 #define get_property(x) internal_get_property(ly_symbol2scm(x))
24 #define TRANSLATOR_DECLARATIONS(NAME) \
27 VIRTUAL_COPY_CONS (Translator); \
28 static SCM static_description_; \
29 virtual SCM static_translator_description () const; \
30 virtual SCM translator_description () const;
33 Translate music into grobs.
39 Music_output_def * output_def_;
41 bool is_alias (SCM) const;
42 Translator (Translator const &);
45 Translator_group * daddy_trans_ ;
46 void removal_processing ();
47 Music_output_def *get_output_def () const;
49 SCM internal_get_property (SCM symbol) const;
51 virtual Moment now_mom () const;
58 SCM trans_group_list_;
60 virtual SCM get_simple_trans_list ();
62 DECLARE_SMOBS (Translator, dummy);
65 ugh: bubbled up from Translator_group.
68 protected: // should be private.
69 SCM simple_trans_list_;
70 friend class Context_def;
72 Global_translator * top_translator () const;
73 TRANSLATOR_DECLARATIONS(Translator);
74 virtual bool try_music (Music *req);
75 virtual void stop_translation_timestep ();
76 virtual void start_translation_timestep ();
77 virtual void do_announces () ;
78 virtual void initialize () ;
79 virtual void finalize ();
84 A macro to automate administration of translators.
86 #define ADD_THIS_TRANSLATOR(T) \
87 SCM T::static_description_ = SCM_EOL;\
88 static void _ ## T ## _adder () {\
90 T::static_description_ = t->static_translator_description ();\
91 scm_permanent_object (T::static_description_);\
94 SCM T::translator_description() const\
96 return static_description_;\
98 ADD_GLOBAL_CTOR (_ ## T ## _adder);
103 #define ENTER_DESCRIPTION(classname,desc,grobs,accepted,acked,read,write) \
104 ADD_THIS_TRANSLATOR (classname);\
106 classname::static_translator_description () const \
108 SCM static_properties= SCM_EOL; \
109 /* static_properties= acons (name ,gh_str02scm (Translator::name (self_scm ())), \
110 static_properties_); \
112 static_properties= scm_acons (ly_symbol2scm ("grobs-created"), \
113 parse_symbol_list (grobs), static_properties); \
115 static_properties= scm_acons (ly_symbol2scm ("description"), \
116 scm_makfrom0str (desc), static_properties); \
118 static_properties= scm_acons (ly_symbol2scm ("interfaces-acked"), \
119 parse_symbol_list (acked), static_properties); \
120 static_properties= scm_acons (ly_symbol2scm ("events-accepted"), \
121 parse_symbol_list (accepted), static_properties); \
123 static_properties= scm_acons (ly_symbol2scm ("properties-read"), \
124 parse_symbol_list (read), static_properties); \
126 static_properties= scm_acons (ly_symbol2scm ("properties-written"), \
127 parse_symbol_list (write), static_properties); \
129 return static_properties; \
134 void add_translator (Translator*trans);
136 Translator*get_translator (SCM s);
137 DECLARE_UNSMOB(Translator,translator);
138 #endif // TRANSLATOR_HH