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_ = s.output_def_;
44 type_string_ = s.type_string_;
50 Translator::is_alias_b (String s) const
52 bool b = s == type_string_;
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_->now_mom ();
75 Translator::removal_processing ()
81 Translator::do_announces ()
86 Translator::get_output_def () const
92 Translator::internal_get_property (SCM sym) const
94 return daddy_trans_->internal_get_property (sym);
98 Translator:: stop_translation_timestep ()
103 Translator::start_translation_timestep ()
108 Translator::initialize ()
113 Translator::finalize ()
124 Translator::mark_smob (SCM sm)
126 Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
127 scm_gc_mark (me->simple_trans_list_);
128 scm_gc_mark (me->trans_group_list_);
129 scm_gc_mark (me->definition_);
130 scm_gc_mark (me->properties_scm_);
132 return me->properties_scm_;
135 LY_DEFINE(ly_translator_name,
136 "ly-translator-name", 1,0,0, (SCM trans),
137 "Return the type name of the translator @var{trans}.
140 Translator* tr = unsmob_translator (trans);
141 SCM_ASSERT_TYPE(tr, trans, SCM_ARG1, __FUNCTION__, "Context");
143 char const* nm = classname (tr);
144 return scm_makfrom0str (nm);
147 LY_DEFINE(ly_translator_description,
148 "ly-translator-description",
150 "Return an alist of properties of translator @var{me}.")
152 Translator *tr =unsmob_translator (me);
153 SCM_ASSERT_TYPE (tr, me, SCM_ARG1, __FUNCTION__, "Context");
155 return tr->translator_description ();
159 Translator::translator_description () const
165 Translator::print_smob (SCM s, SCM port, scm_print_state *)
167 Translator *sc = (Translator *) ly_cdr (s);
169 scm_puts ("#<Translator ", port);
170 scm_display (ly_translator_name (s), port);
171 scm_display (sc->simple_trans_list_, port);
173 don't try to print properties, that is too much hassle.
175 scm_puts (" >", port);
181 Translator::static_translator_description ()const
187 IMPLEMENT_SMOBS (Translator);
188 IMPLEMENT_DEFAULT_EQUAL_P (Translator);