2 translator.hh -- declare Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "global-ctor.hh"
14 #include "lily-proto.hh"
15 #include "virtual-methods.hh"
19 struct Acknowledge_information
22 Engraver_void_function_engraver_grob_info function_;
25 #define TRANSLATOR_DECLARATIONS(NAME) \
28 VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
29 static SCM static_description_; \
30 static Array<Acknowledge_information> acknowledge_static_array_; \
31 virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]);\
32 virtual SCM static_translator_description () const; \
33 virtual SCM translator_description () const; \
34 virtual Engraver_void_function_engraver_grob_info get_acknowledger (SCM sym) { \
35 return static_get_acknowledger (sym);\
37 static Engraver_void_function_engraver_grob_info static_get_acknowledger (SCM sym);
39 #define DECLARE_ACKNOWLEDGER(x) public: void acknowledge_ ## x (Grob_info); protected:
41 enum Translator_precompute_index {
42 START_TRANSLATION_TIMESTEP,
43 STOP_TRANSLATION_TIMESTEP,
46 TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
50 #define PRECOMPUTED_VIRTUAL
54 Translate music into grobs.
64 bool must_be_last () const;
66 Context *context () const { return daddy_context_; }
68 Translator (Translator const &);
70 SCM internal_get_property (SCM symbol) const;
72 virtual Output_def *get_output_def () const;
73 virtual Translator_group *get_daddy_translator ()const;
74 virtual Moment now_mom () const;
76 virtual bool try_music (Music *req);
77 virtual void initialize ();
78 virtual void finalize ();
80 PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
81 PRECOMPUTED_VIRTUAL void start_translation_timestep ();
82 PRECOMPUTED_VIRTUAL void process_music ();
83 PRECOMPUTED_VIRTUAL void process_acknowledged ();
85 Score_context *get_score_context () const;
86 Global_context *get_global_context () const;
88 TRANSLATOR_DECLARATIONS (Translator);
89 DECLARE_SMOBS (Translator, dummy);
90 protected: // should be private.
91 Context *daddy_context_;
92 virtual void derived_mark () const;
94 friend class Context_def;
97 void add_translator (Translator *trans);
99 Translator *get_translator (SCM s);
100 DECLARE_UNSMOB (Translator, translator);
101 #endif // TRANSLATOR_HH