lilypond-1.5.9
[lilypond.git] / lily / global-gravs.cc
blob784c1939391c468adb4f377af1b9132b6e1aac3e
1 /*
2 global-gravs.cc -- implement Engraver,Performer ctors
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "proto.hh"
10 #include "plist.hh"
11 #include "input-translator.hh"
12 #include "debug.hh"
13 #include "engraver.hh"
15 struct Engraver_table_entry {
16 String name_str_;
17 Grav_ctor ctor_l_;
18 Engraver_table_entry (String s, Grav_ctor f)
20 name_str_ =s;
21 ctor_l_ = f;
23 Engraver_table_entry()
25 ctor_l_ =0;
29 static Array<Engraver_table_entry> *grav_table=0;
31 void
32 add_engraver (String s, Grav_ctor f)
34 if (!grav_table)
35 grav_table = new Array<Engraver_table_entry>;
37 grav_table->push (Engraver_table_entry (s, f));
41 Engraver*
42 get_engraver_p (String s)
44 for (int i=0; i < grav_table->size(); i++)
46 if ((*grav_table)[i].name_str_ == s)
47 return (*(*grav_table)[i].ctor_l_)();
49 error ("Unknown engraver `" + s +"\'");
50 return 0;
53 #if 0
55 struct Performer_table_entry
57 String name_str_;
58 Perf_ctor ctor_l_;
59 Performer_table_entry (String s, Perf_ctor f)
61 name_str_ =s;
62 ctor_l_ = f;
64 Performer_table_entry()
66 ctor_l_ =0;
70 static Array<Performer_table_entry> *perf_table=0;
72 void
73 add_performer (String s, Perf_ctor f)
75 if (!perf_table)
76 perf_table = new Array<Performer_table_entry>;
78 perf_table->push (Performer_table_entry (s, f));
82 Performer*
83 get_performer_p (String s)
85 for (int i=0; i < perf_table->size(); i++)
87 if ((*perf_table)[i].name_str_ == s)
88 return (*(*perf_table)[i].ctor_l_)();
90 error ("Unknown performer `" + s +"\'");
91 return 0;
93 #endif