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 ()
41 Translator::Translator (Translator const &s)
45 output_def_ = s.output_def_;
46 type_string_ = s.type_string_;
52 Translator::is_alias_b (String s) const
54 bool b = s == type_string_;
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_->now_mom ();
77 Translator::removal_processing ()
83 Translator::do_announces ()
88 Translator::get_output_def () const
94 Translator::internal_get_property (SCM sym) const
96 return daddy_trans_->internal_get_property (sym);
100 Translator:: stop_translation_timestep ()
105 Translator::start_translation_timestep ()
110 Translator::initialize ()
115 Translator::finalize ()
126 Translator::mark_smob (SCM sm)
128 Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
129 scm_gc_mark (me->simple_trans_list_);
130 scm_gc_mark (me->trans_group_list_);
131 scm_gc_mark (me->definition_);
132 scm_gc_mark (me->properties_scm_);
134 return me->properties_scm_;
137 LY_DEFINE(ly_translator_name,
138 "ly-translator-name", 1,0,0, (SCM trans),
139 "Return the type name of the translator @var{trans}.
142 Translator* tr = unsmob_translator (trans);
143 SCM_ASSERT_TYPE(tr, trans, SCM_ARG1, __FUNCTION__, "Context");
145 char const* nm = classname (tr);
146 return scm_makfrom0str (nm);
149 LY_DEFINE(ly_translator_description,
150 "ly-translator-description",
152 "Return an alist of properties of translator @var{me}.")
154 Translator *tr =unsmob_translator (me);
155 SCM_ASSERT_TYPE (tr, me, SCM_ARG1, __FUNCTION__, "Context");
157 return tr->translator_description ();
161 Translator::translator_description () const
167 Translator::print_smob (SCM s, SCM port, scm_print_state *)
169 Translator *sc = (Translator *) ly_cdr (s);
171 scm_puts ("#<Translator ", port);
172 scm_display (ly_translator_name (s), port);
173 scm_display (sc->simple_trans_list_, port);
175 don't try to print properties, that is too much hassle.
177 scm_puts (" >", port);
183 Translator::static_translator_description ()const
189 IMPLEMENT_SMOBS (Translator);
190 IMPLEMENT_DEFAULT_EQUAL_P (Translator);