lilypond-1.3.130
[lilypond.git] / lily / translator.cc
blob0345c2c370b08e705bfd007d94ea43a7188fc89a
1 /*
2 translator.cc -- implement Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 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"
15 #include "ly-smobs.icc"
17 char const*
18 Translator::name() const
20 return classname(this);
23 Translator::~Translator ()
27 void
28 Translator::init ()
30 simple_trans_list_ = SCM_EOL;
31 trans_group_list_ = SCM_EOL;
32 properties_scm_ = SCM_EOL;
33 definition_ = SCM_EOL;
34 daddy_trans_l_ =0;
37 Translator::Translator ()
39 init ();
40 output_def_l_ = 0;
41 smobify_self ();
45 Translator::Translator (Translator const &s)
46 : Input (s)
48 init ();
49 output_def_l_ = s.output_def_l_;
50 type_str_ = s.type_str_;
52 smobify_self ();
55 bool
56 Translator::is_alias_b (String s) const
58 return s == type_str_;
61 bool
62 Translator::try_music (Music *)
64 return false;
68 Moment
69 Translator::now_mom () const
71 return daddy_trans_l_->now_mom ();
78 void
79 Translator::post_move_processing ()
81 start_translation_timestep ();
84 void
85 Translator::removal_processing ()
87 finalize ();
91 void
92 Translator::announces ()
94 do_announces ();
98 void
99 Translator::pre_move_processing ()
101 stop_translation_timestep ();
106 Music_output_def *
107 Translator::output_def_l () const
109 return output_def_l_;
113 Translator::get_property (char const * id) const
115 return daddy_trans_l_->get_property (ly_symbol2scm (id));
119 Translator::get_property (SCM sym) const
121 return daddy_trans_l_->get_property (sym);
124 void
125 Translator:: stop_translation_timestep ()
129 void
130 Translator::start_translation_timestep ()
134 void
135 Translator::do_announces ()
139 void
140 Translator::initialize ()
144 void
145 Translator::finalize ()
152 SMOBS
156 Translator::mark_smob (SCM sm)
158 Translator * me = (Translator*) SCM_CELL_WORD_1(sm);
159 scm_gc_mark (me->simple_trans_list_);
160 scm_gc_mark (me->trans_group_list_);
161 scm_gc_mark (me->definition_);
162 scm_gc_mark (me->properties_scm_);
164 return me->properties_scm_;
169 Translator::print_smob (SCM s, SCM port, scm_print_state *)
171 Translator *sc = (Translator *) gh_cdr (s);
173 scm_puts ("#<Translator ", port);
174 scm_puts ((char *)sc->name (), port);
175 scm_display (sc->simple_trans_list_, port);
177 don't try to print properties, that is too much hassle.
179 scm_puts (" >", port);
183 return 1;
188 IMPLEMENT_UNSMOB(Translator, translator);
189 IMPLEMENT_SMOBS(Translator);
190 IMPLEMENT_DEFAULT_EQUAL_P(Translator);