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>
11 #include "input-translator.hh"
13 #include "engraver.hh"
15 struct Engraver_table_entry
{
18 Engraver_table_entry (String s
, Grav_ctor f
)
23 Engraver_table_entry()
29 static Array
<Engraver_table_entry
> *grav_table
=0;
32 add_engraver (String s
, Grav_ctor f
)
35 grav_table
= new Array
<Engraver_table_entry
>;
37 grav_table
->push (Engraver_table_entry (s
, f
));
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
+"\'");
55 struct Performer_table_entry
59 Performer_table_entry (String s
, Perf_ctor f
)
64 Performer_table_entry()
70 static Array
<Performer_table_entry
> *perf_table
=0;
73 add_performer (String s
, Perf_ctor f
)
76 perf_table
= new Array
<Performer_table_entry
>;
78 perf_table
->push (Performer_table_entry (s
, f
));
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
+"\'");