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"
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_l_;
42 bool is_alias_b (String) const;
45 Translator (Translator const &);
48 Translator_group * daddy_trans_l_ ;
49 DECLARE_SCHEME_CALLBACK(name, (SCM trans));
50 DECLARE_SCHEME_CALLBACK(description,(SCM trans));
53 void removal_processing ();
55 ask daddy for a feature
57 Music_output_def *output_def_l () const;
59 SCM internal_get_property (SCM symbol) const;
61 virtual Moment now_mom () const;
64 ugh: bubbled up from Translator_group.
66 SCM simple_trans_list_;
67 SCM trans_group_list_;
71 DECLARE_SMOBS (Translator, dummy);
74 TRANSLATOR_DECLARATIONS(Translator);
76 try to fit the request in this engraver
79 false: not noted, not taken.
81 true: request swallowed. Don't try to put the request elsewhere.
84 virtual bool try_music (Music *req_l);
85 virtual void stop_translation_timestep ();
86 virtual void start_translation_timestep ();
87 virtual void do_announces () ;
88 virtual void initialize () ;
89 virtual void finalize ();
94 A macro to automate administration of translators.
96 #define ADD_THIS_TRANSLATOR(T) \
97 SCM T::static_description_ = SCM_EOL;\
98 static void _ ## T ## _adder () {\
100 T::static_description_ = t->static_translator_description ();\
101 scm_permanent_object (T::static_description_);\
102 t->type_str_ = classname (t);\
105 SCM T::translator_description() const\
107 return static_description_;\
109 ADD_GLOBAL_CTOR (_ ## T ## _adder);
114 #define ENTER_DESCRIPTION(classname,desc,grobs,acked,read,write) \
115 ADD_THIS_TRANSLATOR (classname);\
117 classname::static_translator_description () const \
119 SCM static_properties= SCM_EOL; \
120 /* static_properties= acons (name ,gh_str02scm (Translator::name (self_scm ())), \
121 static_properties_); \
123 static_properties= scm_acons (ly_symbol2scm ("grobs-created"), \
124 parse_symbol_list (grobs), static_properties); \
126 static_properties= scm_acons (ly_symbol2scm ("description"), \
127 ly_str02scm (desc), static_properties); \
129 static_properties= scm_acons (ly_symbol2scm ("interfaces-acked"), \
130 parse_symbol_list (acked), static_properties); \
132 static_properties= scm_acons (ly_symbol2scm ("properties-read"), \
133 parse_symbol_list (read), static_properties); \
135 static_properties= scm_acons (ly_symbol2scm ("properties-written"), \
136 parse_symbol_list (write), static_properties); \
138 return static_properties; \
143 extern Dictionary<Translator*> *global_translator_dict_p;
144 void add_translator (Translator*trans_p);
146 Translator*get_translator_l (String s);
147 DECLARE_UNSMOB(Translator,translator);
148 #endif // TRANSLATOR_HH