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
=0;
22 LY_DEFINE(ly_get_all_translators
,"ly-get-all-translators", 0, 0, 0, (),
23 "Return an list of a all translator objects that may be instantiated
24 during a lilypond run.")
27 for (std::map
<String
,Translator
*>::const_iterator (ci (global_translator_dict
->begin()));
28 ci
!= global_translator_dict
->end (); ci
++)
30 l
= scm_cons ((*ci
).second
->self_scm (), l
);
36 add_translator (Translator
*t
)
38 if (!global_translator_dict
)
39 global_translator_dict
= new Dictionary
<Translator
*>;
41 (*global_translator_dict
)[classname (t
)] = t
;
45 get_translator (String s
)
47 if (global_translator_dict
->elem_b (s
))
49 Translator
* t
= (*global_translator_dict
)[s
];
53 error (_f ("unknown translator: `%s'", s
));