2 translator.cc -- implement Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "translator.hh"
12 #include "translator-group.hh"
13 #include "translator-def.hh"
16 #include "ly-smobs.icc"
19 Translator::~Translator ()
26 simple_trans_list_ = SCM_EOL;
27 trans_group_list_ = SCM_EOL;
28 properties_scm_ = SCM_EOL;
29 definition_ = SCM_EOL;
33 Translator::Translator ()
41 Translator::Translator (Translator const &s)
45 output_def_l_ = s.output_def_l_;
46 type_str_ = s.type_str_;
52 Translator::is_alias_b (String s) const
54 bool b = s == type_str_;
56 for (SCM a = unsmob_translator_def (definition_)->type_aliases_;
57 !b && gh_pair_p (a); a = ly_cdr (a))
58 b = b || s == ly_scm2string (ly_car (a));
64 Translator::try_music (Music *)
71 Translator::now_mom () const
73 return daddy_trans_l_->now_mom ();
82 Translator::removal_processing ()
89 Translator::announces ()
96 Translator::output_def_l () const
102 Translator::get_property (char const * id) const
104 return daddy_trans_l_->get_property (ly_symbol2scm (id));
109 Translator::internal_get_property (SCM sym) const
111 return daddy_trans_l_->internal_get_property (sym);
115 Translator:: stop_translation_timestep ()
120 Translator::start_translation_timestep ()
125 Translator::do_announces ()
130 Translator::initialize ()
135 Translator::finalize ()
146 Translator::mark_smob (SCM sm)
148 Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
149 scm_gc_mark (me->simple_trans_list_);
150 scm_gc_mark (me->trans_group_list_);
151 scm_gc_mark (me->definition_);
152 scm_gc_mark (me->properties_scm_);
154 return me->properties_scm_;
157 MAKE_SCHEME_CALLBACK(Translator,name,1);
159 Translator::name (SCM trans)
161 if (unsmob_translator (trans))
163 char const* nm = classname (unsmob_translator (trans));
164 return ly_str02scm (nm);
170 MAKE_SCHEME_CALLBACK(Translator,description,1)
172 Translator::description (SCM me)
174 if (unsmob_translator (me))
175 return unsmob_translator(me)->translator_description ();
178 programming_error ("Translator::description ()");
184 Translator::translator_description () const
190 Translator::print_smob (SCM s, SCM port, scm_print_state *)
192 Translator *sc = (Translator *) ly_cdr (s);
194 scm_puts ("#<Translator ", port);
195 scm_display (name (s), port);
196 scm_display (sc->simple_trans_list_, port);
198 don't try to print properties, that is too much hassle.
200 scm_puts (" >", port);
206 Translator::static_translator_description ()const
212 IMPLEMENT_SMOBS (Translator);
213 IMPLEMENT_DEFAULT_EQUAL_P (Translator);