2 translator.hh -- declare Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
12 #include "global-ctor.hh"
13 #include "std-string.hh"
14 #include "lily-proto.hh"
15 #include "virtual-methods.hh"
18 #include "std-vector.hh"
20 struct Acknowledge_information
23 Engraver_void_function_engraver_grob_info function_;
26 #define TRANSLATOR_DECLARATIONS(NAME) \
29 VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
30 static SCM static_description_; \
31 static Drul_array<vector<Acknowledge_information> > acknowledge_static_array_drul_; \
32 virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]); \
33 virtual SCM static_translator_description () const; \
34 virtual SCM translator_description () const; \
35 virtual Engraver_void_function_engraver_grob_info get_acknowledger (SCM sym) \
37 return static_get_acknowledger (sym); \
39 virtual Engraver_void_function_engraver_grob_info get_end_acknowledger (SCM sym) \
41 return static_get_end_acknowledger (sym); \
43 static Engraver_void_function_engraver_grob_info static_get_acknowledger (SCM sym); \
44 static Engraver_void_function_engraver_grob_info static_get_end_acknowledger(SCM); \
48 #define DECLARE_ACKNOWLEDGER(x) public : void acknowledge_ ## x (Grob_info); protected:
49 #define DECLARE_END_ACKNOWLEDGER(x) public : void acknowledge_end_ ## x (Grob_info); protected:
51 enum Translator_precompute_index
53 START_TRANSLATION_TIMESTEP,
54 STOP_TRANSLATION_TIMESTEP,
57 TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
61 Translate music into grobs.
71 bool must_be_last () const;
73 Context *context () const { return daddy_context_; }
75 Translator (Translator const &);
77 SCM internal_get_property (SCM symbol) const;
79 virtual Output_def *get_output_def () const;
80 virtual Translator_group *get_daddy_translator ()const;
81 virtual Moment now_mom () const;
83 virtual bool try_music (Music *req);
84 virtual void initialize ();
85 virtual void finalize ();
87 void stop_translation_timestep ();
88 void start_translation_timestep ();
89 void process_music ();
90 void process_acknowledged ();
92 Score_context *get_score_context () const;
93 Global_context *get_global_context () const;
95 TRANSLATOR_DECLARATIONS (Translator);
96 DECLARE_SMOBS (Translator, dummy);
98 protected: // should be private.
99 Context *daddy_context_;
100 virtual void derived_mark () const;
102 friend class Context_def;
103 friend class Context;
105 void add_translator (Translator *trans);
107 Translator *get_translator (SCM s);
108 DECLARE_UNSMOB (Translator, translator);
109 #endif // TRANSLATOR_HH