2 input-register.cc -- implement Input_register
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "register.hh"
11 #include "input-register.hh"
13 #include "input-register.hh"
14 #include "register-group.hh"
17 Input_register::is_name_b(String n
)
19 bool b
= (n
== name_str_
);
20 for (int i
=0; !b
&& i
< alias_str_arr_
.size(); i
++)
21 b
= b
|| (alias_str_arr_
[i
] == n
);
26 Input_register::print() const
29 mtor
<< "name " << name_str_
;
30 mtor
<< "Consists of ";
31 for (int i
=0; i
< consists_str_arr_
.size(); i
++)
32 mtor
<< consists_str_arr_
[i
] << ',';
34 for (iter(contains_ireg_p_list_
.top(), i
); i
.ok(); i
++)
42 Link_array
<Input_register
> iregs_p_arr
;
45 add_global_input_register(Input_register
*reg_p
)
47 iregs_p_arr
.push(reg_p
);
53 for (int i
=0; i
< iregs_p_arr
.size(); i
++)
54 if (iregs_p_arr
[i
]->is_name_b(nm
))
55 return iregs_p_arr
[i
];
57 error("can't find reg `" + nm
+ "'");
63 Input_register::recursive_find(String nm
)
68 Input_register
* r
=0;
69 for (iter(contains_ireg_p_list_
.top(), i
); !r
&&i
.ok(); i
++)
70 r
= i
->recursive_find(nm
);
75 Input_register::find_ireg_l(String nm
)
77 for (iter(contains_ireg_p_list_
.top(), i
); i
.ok(); i
++)
78 if (i
->is_name_b( nm
))
85 Register_group_register
*
86 Input_register::get_group_register_p()
88 Register_group_register
* reg_p
= (Register_group_register
*)
89 get_register_p(name_str_
);
93 for (int i
=0; i
< consists_str_arr_
.size(); i
++) {
94 reg_p
->add( get_register_p( consists_str_arr_
[i
]) );
96 reg_p
-> ireg_l_
= this;
102 Input_register::accept_req_b()
104 return ! contains_ireg_p_list_
.size();
108 Input_register::add(Input_register
*ip
)
110 contains_ireg_p_list_
.bottom().add(ip
);
114 Input_register::get_default_ireg_l()
116 return contains_ireg_p_list_
.top();