2 global-regs.cc -- implement
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
11 #include "input-register.hh"
13 #include "register.hh"
15 struct Request_register_table_entry
{
18 Request_register_table_entry(String s
, Reg_ctor f
) {
22 Request_register_table_entry()
28 static Array
<Request_register_table_entry
> *reg_table
=0;
31 add_request_register(String s
, Reg_ctor f
)
34 reg_table
= new Array
<Request_register_table_entry
>;
36 reg_table
->push(Request_register_table_entry(s
, f
));
41 get_register_p(String s
)
43 for (int i
=0; i
< reg_table
->size(); i
++) {
44 if ((*reg_table
)[i
].name_str_
== s
)
45 return (*(*reg_table
)[i
].ctor_l_
)();
47 error("Unknown register `" + s
+"\'");