2 translator.hh -- declare Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 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"
22 #define get_property(x) internal_get_property(ly_symbol2scm(x))
25 #define TRANSLATOR_DECLARATIONS(NAME) \
28 VIRTUAL_COPY_CONS (Translator); \
29 static SCM static_description_; \
30 virtual SCM static_translator_description () const; \
31 virtual SCM translator_description () const;
34 Translate music into grobs.
40 Music_output_def * output_def_l_;
43 bool is_alias_b (String) const;
46 Translator (Translator const &);
49 Translator_group * daddy_trans_l_ ;
50 DECLARE_SCHEME_CALLBACK(name, (SCM trans));
51 DECLARE_SCHEME_CALLBACK(description,(SCM trans));
54 void removal_processing ();
56 ask daddy for a feature
58 Music_output_def *output_def_l () const;
60 SCM internal_get_property (SCM symbol) const;
62 virtual Moment now_mom () const;
65 ugh: bubbled up from Translator_group.
67 SCM simple_trans_list_;
68 SCM trans_group_list_;
72 DECLARE_SMOBS (Translator, dummy);
75 TRANSLATOR_DECLARATIONS(Translator);
77 try to fit the request in this engraver
80 false: not noted, not taken.
82 true: request swallowed. Don't try to put the request elsewhere.
85 virtual bool try_music (Music *req_l);
86 virtual void stop_translation_timestep ();
87 virtual void start_translation_timestep ();
88 virtual void do_announces () ;
89 virtual void initialize () ;
90 virtual void finalize ();
95 A macro to automate administration of translators.
97 #define ADD_THIS_TRANSLATOR(T) \
98 SCM T::static_description_ = SCM_EOL;\
99 static void _ ## T ## _adder () {\
101 T::static_description_ = t->static_translator_description ();\
102 scm_permanent_object (T::static_description_);\
103 t->type_str_ = classname (t);\
106 SCM T::translator_description() const\
108 return static_description_;\
110 ADD_GLOBAL_CTOR (_ ## T ## _adder);
115 #define ENTER_DESCRIPTION(classname,desc,grobs,acked,read,write) \
116 ADD_THIS_TRANSLATOR (classname);\
118 classname::static_translator_description () const \
120 SCM static_properties= SCM_EOL; \
121 /* static_properties= acons (name ,gh_str02scm (Translator::name (self_scm ())), \
122 static_properties_); \
124 static_properties= scm_acons (ly_symbol2scm ("grobs-created"), \
125 parse_symbol_list (grobs), static_properties); \
127 static_properties= scm_acons (ly_symbol2scm ("description"), \
128 ly_str02scm (desc), static_properties); \
130 static_properties= scm_acons (ly_symbol2scm ("interfaces-acked"), \
131 parse_symbol_list (acked), static_properties); \
133 static_properties= scm_acons (ly_symbol2scm ("properties-read"), \
134 parse_symbol_list (read), static_properties); \
136 static_properties= scm_acons (ly_symbol2scm ("properties-written"), \
137 parse_symbol_list (write), static_properties); \
139 return static_properties; \
144 extern Dictionary<Translator*> *global_translator_dict_p;
145 void add_translator (Translator*trans_p);
147 Translator*get_translator_l (String s);
148 DECLARE_UNSMOB(Translator,translator);
149 #endif // TRANSLATOR_HH