]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator-ctors.cc
release: 1.3.19
[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--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "proto.hh"
10 #include "translator.hh"
11 #include "dictionary.hh"
12 #include "debug.hh"
13
14 /*
15   should delete these after exit.
16  */
17
18 Dictionary<Translator*> *global_translator_dict_p=0;
19
20 void
21 add_translator (Translator *t)
22 {
23   if (!global_translator_dict_p)
24     global_translator_dict_p = new Dictionary<Translator*>;
25
26   global_translator_dict_p->elem (classname (t)) = t;
27 }
28
29 Translator*
30 get_translator_l (String s)
31 {
32   if (global_translator_dict_p->elem_b (s))
33     {
34 //      return (*global_translator_dict_p)[s];
35         Translator* t = (*global_translator_dict_p)[s];
36         return t;
37     }
38
39   error (_f ("unknown translator: `%s'", s));
40   return 0;
41 }
42