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 vector<Acknowledge_information> acknowledge_static_array_; \
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 static Engraver_void_function_engraver_grob_info static_get_acknowledger (SCM sym);
41 #define DECLARE_ACKNOWLEDGER(x) public : void acknowledge_ ## x (Grob_info); protected:
43 enum Translator_precompute_index
45 START_TRANSLATION_TIMESTEP,
46 STOP_TRANSLATION_TIMESTEP,
49 TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
53 Translate music into grobs.
63 bool must_be_last () const;
65 Context *context () const { return daddy_context_; }
67 Translator (Translator const &);
69 SCM internal_get_property (SCM symbol) const;
71 virtual Output_def *get_output_def () const;
72 virtual Translator_group *get_daddy_translator ()const;
73 virtual Moment now_mom () const;
75 virtual bool try_music (Music *req);
76 virtual void initialize ();
77 virtual void finalize ();
79 void stop_translation_timestep ();
80 void start_translation_timestep ();
81 void process_music ();
82 void process_acknowledged ();
84 Score_context *get_score_context () const;
85 Global_context *get_global_context () const;
87 TRANSLATOR_DECLARATIONS (Translator);
88 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