2 translator-ctors.cc -- implement Translator construction
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "translator.hh"
12 #include "dictionary.hh"
16 should delete these after exit.
19 Dictionary<Translator*> *global_translator_dict_p=0;
22 add_translator (Translator *t)
24 if (!global_translator_dict_p)
25 global_translator_dict_p = new Dictionary<Translator*>;
27 global_translator_dict_p->elem (t->name ()) = t;
31 get_translator_l (String s)
33 if (global_translator_dict_p->elem_b (s))
35 // return (*global_translator_dict_p)[s];
36 Translator* t = (*global_translator_dict_p)[s];
40 error (_f ("unknown translator `%s\'", s));
44 Array<Translator_ctor> *ctor_global_static_arr_p_;
48 Very special greetings go out to Steve Jobs for creating a system
49 that doesn't handle global construction correctly.
52 add_constructor (Translator_ctor c)
54 if (!ctor_global_static_arr_p_)
55 ctor_global_static_arr_p_ = new Array<Translator_ctor>;
56 ctor_global_static_arr_p_->push (c);
62 for (int i=0; i < ctor_global_static_arr_p_->size (); i++)
63 add_translator (ctor_global_static_arr_p_->elem (i) ());