2 translator-ctors.cc -- implement Translator construction
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "translator.hh"
10 #include "dictionary.hh"
14 should delete these after exit.
18 UGH. Dictionary is deprecated
20 Dictionary<Translator*> *global_translator_dict_p=0;
24 ly_get_all_translators ()
27 for (std::map<String,Translator*>::const_iterator (ci (global_translator_dict_p->begin()));
28 ci != global_translator_dict_p->end (); ci++)
30 l = scm_cons ((*ci).second->self_scm (), l);
38 scm_c_define_gsubr ("ly-get-all-translators", 0, 0, 0, (Scheme_function_unknown) ly_get_all_translators);
41 ADD_SCM_INIT_FUNC(all_trans_init,all_trans_init);
44 add_translator (Translator *t)
46 if (!global_translator_dict_p)
47 global_translator_dict_p = new Dictionary<Translator*>;
49 (*global_translator_dict_p)[classname (t)] = t;
53 get_translator_l (String s)
55 if (global_translator_dict_p->elem_b (s))
57 Translator* t = (*global_translator_dict_p)[s];
61 error (_f ("unknown translator: `%s'", s));