lilypond-1.3.12
[lilypond.git] / lily / translator.cc
blob515a85af9bbba3ea26dabcee6468d4fd5d9474f6
1 /*
2 translator.cc -- implement Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
10 #include "translator.hh"
11 #include "debug.hh"
12 #include "translator-group.hh"
14 #include "moment.hh"
16 char const*
17 Translator::name() const
19 return classname(this);
22 Translator::~Translator ()
26 Translator::Translator ()
28 status = ORPHAN;
29 daddy_trans_l_ = 0;
30 output_def_l_ = 0;
33 Translator::Translator (Translator const &s)
34 : Input (s)
36 status = ORPHAN;
37 daddy_trans_l_ =0;
38 output_def_l_ = s.output_def_l_;
39 type_str_ = s.type_str_;
42 bool
43 Translator::is_alias_b (String s) const
45 return s == type_str_;
48 bool
49 Translator::do_try_music (Music *)
51 return false;
55 Moment
56 Translator::now_mom () const
58 return daddy_trans_l_->now_mom ();
62 void
63 Translator::add_processing ()
65 if (status > ORPHAN)
66 return;
68 do_add_processing ();
69 status = VIRGIN;
72 void
73 Translator::do_add_processing ()
77 void
78 Translator::print () const
80 #ifndef NPRINT
81 DEBUG_OUT << classname (this) << " {";
82 if (classname (this) != type_str_)
83 DEBUG_OUT << "type = " << type_str_;
84 do_print ();
85 DEBUG_OUT << "}\n";
86 #endif
89 void
90 Translator::do_print () const
97 void
98 Translator::creation_processing ()
100 if (status >= CREATION_INITED)
101 return ;
103 do_creation_processing ();
104 status = CREATION_INITED;
107 void
108 Translator::post_move_processing ()
110 if (status >= MOVE_INITED)
111 return;
113 creation_processing ();
114 do_post_move_processing ();
115 status = MOVE_INITED;
118 void
119 Translator::removal_processing ()
121 if (status == ORPHAN)
122 return;
123 creation_processing ();
124 do_removal_processing ();
125 // elegancy ...
126 // status = ORPHAN;
130 bool
131 Translator::try_music (Music * r)
133 if (status < MOVE_INITED)
134 post_move_processing ();
136 return do_try_music (r);
139 void
140 Translator::process_requests ()
142 if (status < PROCESSED_REQS)
143 post_move_processing ();
144 else if (status >= PROCESSED_REQS)
145 return;
147 status = PROCESSED_REQS;
148 do_process_requests ();
151 void
152 Translator::pre_move_processing ()
154 do_pre_move_processing ();
155 status = CREATION_INITED;
160 Music_output_def *
161 Translator::output_def_l () const
163 return output_def_l_;
167 Translator::get_property (String id, Translator_group **where_l) const
169 return daddy_trans_l_->get_property (ly_symbol2scm (id.ch_C()), where_l);
173 Translator::get_property (SCM sym,
174 Translator_group **where_l) const
176 return daddy_trans_l_->get_property (sym, where_l);
181 void
182 Translator:: do_pre_move_processing(){}
183 void
184 Translator::do_post_move_processing(){}
185 void
186 Translator::do_process_requests () {}
187 void
188 Translator::do_creation_processing() {}
189 void
190 Translator::do_removal_processing(){}