2 translator.cc -- implement Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 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 ()
40 Translator::Translator (Translator const &s)
43 output_def_l_ = s.output_def_l_;
44 type_str_ = s.type_str_;
50 Translator::is_alias_b (String s) const
52 bool b = s == type_str_;
54 for (SCM a = unsmob_translator_def (definition_)->type_aliases_;
55 !b && gh_pair_p (a); a = ly_cdr (a))
56 b = b || s == ly_scm2string (ly_car (a));
62 Translator::try_music (Music *)
69 Translator::now_mom () const
71 return daddy_trans_l_->now_mom ();
75 Translator::removal_processing ()
81 Translator::announces ()
87 Translator::output_def_l () const
93 Translator::internal_get_property (SCM sym) const
95 return daddy_trans_l_->internal_get_property (sym);
99 Translator:: stop_translation_timestep ()
104 Translator::start_translation_timestep ()
109 Translator::do_announces ()
114 Translator::initialize ()
119 Translator::finalize ()
130 Translator::mark_smob (SCM sm)
132 Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
133 scm_gc_mark (me->simple_trans_list_);
134 scm_gc_mark (me->trans_group_list_);
135 scm_gc_mark (me->definition_);
136 scm_gc_mark (me->properties_scm_);
138 return me->properties_scm_;
141 LY_DEFINE(ly_translator_name,
142 "ly-translator-name", 1,0,0, (SCM trans),
143 "Return the type name of the translator @var{trans}.
146 Translator* tr = unsmob_translator (trans);
147 SCM_ASSERT_TYPE(tr, trans, SCM_ARG1, __FUNCTION__, "Context");
149 char const* nm = classname (tr);
150 return ly_str02scm (nm);
153 LY_DEFINE(ly_translator_description,
154 "ly-translator-description",
156 "Return an alist of properties of translator @var{me}.")
158 Translator *tr =unsmob_translator (me);
159 SCM_ASSERT_TYPE (tr, me, SCM_ARG1, __FUNCTION__, "Context");
161 return tr->translator_description ();
165 Translator::translator_description () const
171 Translator::print_smob (SCM s, SCM port, scm_print_state *)
173 Translator *sc = (Translator *) ly_cdr (s);
175 scm_puts ("#<Translator ", port);
176 scm_display (ly_translator_name (s), port);
177 scm_display (sc->simple_trans_list_, port);
179 don't try to print properties, that is too much hassle.
181 scm_puts (" >", port);
187 Translator::static_translator_description ()const
193 IMPLEMENT_SMOBS (Translator);
194 IMPLEMENT_DEFAULT_EQUAL_P (Translator);