2 translator-ctors.cc -- implement Translator construction
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "translator.hh"
14 should delete these after exit.
17 std::map<String,Translator*> *global_translator_dict=0;
19 LY_DEFINE(get_all_translators,"ly:get-all-translators", 0, 0, 0, (),
20 "Return an list of a all translator objects that may be instantiated "
21 " during a lilypond run.")
24 for (std::map<String,Translator*>::const_iterator (ci (global_translator_dict->begin()));
25 ci != global_translator_dict->end (); ci++)
27 l = scm_cons ((*ci).second->self_scm (), l);
33 add_translator (Translator *t)
35 if (!global_translator_dict)
36 global_translator_dict = new std::map<String,Translator*>;
38 (*global_translator_dict)[classname (t)] = t;
42 get_translator (String s)
44 if (global_translator_dict->find (s) !=
45 global_translator_dict->end ())
47 Translator* t = (*global_translator_dict)[s];
51 error (_f ("unknown translator: `%s'", s));