]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator-ctors.cc
patch::: 1.3.136.jcn3
[lilypond.git] / lily / translator-ctors.cc
1 /*
2   translator-ctors.cc -- implement Translator construction
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "translator.hh"
10 #include "dictionary.hh"
11 #include "debug.hh"
12
13 /*
14   should delete these after exit.
15  */
16
17 /*
18   UGH. Dictionary is deprecated
19  */
20 Dictionary<Translator*> *global_translator_dict_p=0;
21
22 void
23 add_translator (Translator *t)
24 {
25   if (!global_translator_dict_p)
26     global_translator_dict_p = new Dictionary<Translator*>;
27
28  (*global_translator_dict_p)[classname (t)] = t;
29 }
30
31 Translator*
32 get_translator_l (String s)
33 {
34   if (global_translator_dict_p->elem_b (s))
35     {
36         Translator* t = (*global_translator_dict_p)[s];
37         return t;
38     }
39
40   error (_f ("unknown translator: `%s'", s));
41   return 0;
42 }
43