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"
21 typedef void (*Translator_void_method_ptr)(Translator*);
23 #define DECLARE_STATIC_METHOD(x) static void x ## _static (Translator*)
24 #define TRANSLATOR_DECLARATIONS(NAME) \
26 DECLARE_STATIC_METHOD(start_translation_timestep); \
27 DECLARE_STATIC_METHOD(stop_translation_timestep); \
28 DECLARE_STATIC_METHOD(process_music); \
29 DECLARE_STATIC_METHOD(process_acknowledged); \
31 VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
32 static SCM static_description_; \
33 virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]);\
34 virtual SCM static_translator_description () const; \
35 virtual SCM translator_description () const;
38 enum Translator_precompute_index {
39 START_TRANSLATION_TIMESTEP,
40 STOP_TRANSLATION_TIMESTEP,
43 TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
47 #define PRECOMPUTED_VIRTUAL
51 Translate music into grobs.
61 bool must_be_last () const;
63 Context *context () const { return daddy_context_; }
65 Translator (Translator const &);
67 SCM internal_get_property (SCM symbol) const;
69 virtual Output_def *get_output_def () const;
70 virtual Translator_group *get_daddy_translator ()const;
71 virtual Moment now_mom () const;
73 virtual bool try_music (Music *req);
74 virtual void initialize ();
75 virtual void finalize ();
77 PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
78 PRECOMPUTED_VIRTUAL void start_translation_timestep ();
79 PRECOMPUTED_VIRTUAL void process_music ();
80 PRECOMPUTED_VIRTUAL void process_acknowledged ();
83 Score_context *get_score_context () const;
84 Global_context *get_global_context () const;
86 TRANSLATOR_DECLARATIONS (Translator);
87 DECLARE_SMOBS (Translator, dummy);
88 protected: // should be private.
89 Context *daddy_context_;
90 virtual void derived_mark () const;
92 friend class Context_def;
95 void add_translator (Translator *trans);
97 Translator *get_translator (SCM s);
98 DECLARE_UNSMOB (Translator, translator);
99 #endif // TRANSLATOR_HH