]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator-ctors.cc
release: 0.1.24
[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 Han-Wen Nienhuys <hanwen@stack.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 Dictionary<Translator*> *global_translator_dict_p=0;
16
17 void
18 add_translator (Translator *t)
19 {
20   if (!global_translator_dict_p)
21     global_translator_dict_p = new Dictionary<Translator*>;
22
23   global_translator_dict_p->elem (t->name ()) = t;
24 }
25
26 Translator*
27 get_translator_l (String s)
28 {
29   if (global_translator_dict_p->elt_b (s))
30     {
31       return (*global_translator_dict_p)[s];
32     }
33
34   error (_("Unknown translator `") + s +"\'");
35   return 0;
36 }