lilypond-1.1.67
[lilypond.git] / lily / global-performers.cc
blob69102aaf234b3ae07f8454597bda5744be86d450
1 /*
2 global-performers.cc -- implement
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 Jan Nieuwenhuizen <jan@digicash.com>
8 */
10 #include "proto.hh"
11 #include "plist.hh"
12 #include "input-translator.hh"
13 #include "debug.hh"
14 #include "performer.hh"
16 struct Performer_table_entry {
17 String name_str_;
18 Perf_ctor ctor_l_;
19 Performer_table_entry (String s, Perf_ctor f)
21 name_str_ =s;
22 ctor_l_ = f;
24 Performer_table_entry()
26 ctor_l_ =0;
30 static Array<Performer_table_entry> *perf_table=0;
32 void
33 add_Performer (String s, Perf_ctor f)
35 if (!perf_table)
36 perf_table = new Array<Performer_table_entry>;
38 perf_table->push (Performer_table_entry (s, f));
42 Performer*
43 get_performer_p (String s)
45 for (int i=0; i < perf_table->size(); i++)
47 if ((*perf_table)[i].name_str_ == s)
48 return (*(*perf_table)[i].ctor_l_)();
50 error ("Unknown performer `" + s +"\'");
51 return 0;