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_;
42 bool is_alias_b (String) const;
45 Translator (Translator const &);
48 Translator_group * daddy_trans_ ;
49 void removal_processing ();
51 ask daddy for a feature
53 Music_output_def *get_output_def () const;
55 SCM internal_get_property (SCM symbol) const;
57 virtual Moment now_mom () const;
60 ugh: bubbled up from Translator_group.
62 SCM simple_trans_list_;
63 SCM trans_group_list_;
67 DECLARE_SMOBS (Translator, dummy);
70 TRANSLATOR_DECLARATIONS(Translator);
72 try to fit the request in this engraver
75 false: not noted, not taken.
77 true: request swallowed. Don't try to put the request elsewhere.
80 virtual bool try_music (Music *req);
81 virtual void stop_translation_timestep ();
82 virtual void start_translation_timestep ();
83 virtual void do_announces () ;
84 virtual void initialize () ;
85 virtual void finalize ();
90 A macro to automate administration of translators.
92 #define ADD_THIS_TRANSLATOR(T) \
93 SCM T::static_description_ = SCM_EOL;\
94 static void _ ## T ## _adder () {\
96 T::static_description_ = t->static_translator_description ();\
97 scm_permanent_object (T::static_description_);\
98 t->type_string_ = classname (t);\
101 SCM T::translator_description() const\
103 return static_description_;\
105 ADD_GLOBAL_CTOR (_ ## T ## _adder);
110 #define ENTER_DESCRIPTION(classname,desc,grobs,acked,read,write) \
111 ADD_THIS_TRANSLATOR (classname);\
113 classname::static_translator_description () const \
115 SCM static_properties= SCM_EOL; \
116 /* static_properties= acons (name ,gh_str02scm (Translator::name (self_scm ())), \
117 static_properties_); \
119 static_properties= scm_acons (ly_symbol2scm ("grobs-created"), \
120 parse_symbol_list (grobs), static_properties); \
122 static_properties= scm_acons (ly_symbol2scm ("description"), \
123 scm_makfrom0str (desc), static_properties); \
125 static_properties= scm_acons (ly_symbol2scm ("interfaces-acked"), \
126 parse_symbol_list (acked), static_properties); \
128 static_properties= scm_acons (ly_symbol2scm ("properties-read"), \
129 parse_symbol_list (read), static_properties); \
131 static_properties= scm_acons (ly_symbol2scm ("properties-written"), \
132 parse_symbol_list (write), static_properties); \
134 return static_properties; \
139 extern Dictionary<Translator*> *global_translator_dict;
140 void add_translator (Translator*trans);
142 Translator*get_translator (String s);
143 DECLARE_UNSMOB(Translator,translator);
144 #endif // TRANSLATOR_HH