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