2 translator.icc -- declare Translator glue wiring.
4 source file of the GNU LilyPond music typesetter
6 (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #ifndef TRANSLATOR_ICC
11 #define TRANSLATOR_ICC
14 A macro to automate administration of translators.
16 #define ADD_THIS_TRANSLATOR(T) \
17 SCM T::static_description_ = SCM_EOL; \
18 static void _ ## T ## _adder () \
21 T::static_description_ = t->static_translator_description (); \
22 scm_permanent_object (T::static_description_); \
25 SCM T::translator_description () const \
27 return static_description_; \
29 ADD_GLOBAL_CTOR (_ ## T ## _adder);
31 #define ADD_TRANSLATOR(classname, desc, grobs, accepted, acked, read, write) \
32 IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(classname); \
33 ADD_THIS_TRANSLATOR (classname); \
35 classname::static_translator_description () const \
37 SCM static_properties = SCM_EOL; \
38 /* static_properties = acons (name , gh_str02scm (Translator::name (self_scm ())), \
39 static_properties_); \
41 static_properties = scm_acons (ly_symbol2scm ("grobs-created"), \
42 parse_symbol_list (grobs), static_properties); \
44 static_properties = scm_acons (ly_symbol2scm ("description"), \
45 scm_makfrom0str (desc), static_properties); \
47 static_properties = scm_acons (ly_symbol2scm ("interfaces-acked"), \
48 parse_symbol_list (acked), static_properties); \
49 static_properties = scm_acons (ly_symbol2scm ("events-accepted"), \
50 parse_symbol_list (accepted), static_properties); \
52 static_properties = scm_acons (ly_symbol2scm ("properties-read"), \
53 parse_symbol_list (read), static_properties); \
55 static_properties = scm_acons (ly_symbol2scm ("properties-written"), \
56 parse_symbol_list (write), static_properties); \
58 return static_properties; \
61 #define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \
63 T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[])\
65 ptrs[START_TRANSLATION_TIMESTEP] = \
66 ((Translator_void_method_ptr) &T::start_translation_timestep == \
67 (Translator_void_method_ptr) &Translator::start_translation_timestep) \
69 : (Translator_void_method_ptr) &T::start_translation_timestep; \
71 ptrs[STOP_TRANSLATION_TIMESTEP] = \
72 ((Translator_void_method_ptr) &T::stop_translation_timestep == (Translator_void_method_ptr) &Translator::stop_translation_timestep) \
74 : (Translator_void_method_ptr) &T::stop_translation_timestep; \
76 ptrs[PROCESS_MUSIC] = \
77 ((Translator_void_method_ptr) &T::process_music == (Translator_void_method_ptr) &Translator::process_music) \
79 : (Translator_void_method_ptr) &T::process_music; \
81 ptrs[PROCESS_ACKNOWLEDGED] = \
82 ((Translator_void_method_ptr) &T::process_acknowledged == (Translator_void_method_ptr) &Translator::process_acknowledged) \
84 : (Translator_void_method_ptr) &T::process_acknowledged; \
88 #endif /* TRANSLATOR_ICC */