2 symtable.cc -- implement Symbol_table
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #include "dictionary-iter.hh"
14 #include "symtable.hh"
16 Symtables::Symtables()
21 Symtables::Symtables (Symtables
const &s
)
22 : Dictionary
<Symtable
*> (s
)
24 font_name_
= s
.font_name_
;
26 for (Dictionary_iter
< Symtable
*> i (s
); i
.ok(); i
++)
28 add (i
.key(), new Symtable (*i
.val ()));
32 Symtables::~Symtables()
34 for (Dictionary_iter
<Symtable
*> i (*this); i
.ok(); i
++)
41 Symtable::lookup (String s
) const
50 warning (_f ("Symtable `%s\': unknown symbol: `%s\'", id_str
, s
));
57 Symtables::operator()(String s
)
61 error (_f ("Symtable `%s\' unknown", s
));
63 We can 't return, because we would dump core anyway.
71 Symtables::print() const
73 for (Dictionary_iter
<Symtable
*> i (*this); i
.ok(); i
++)
75 DOUT
<< "table \'" << i
.key () << "\' {\n";
81 Symtable::print() const
83 for (Dictionary_iter
<Atom
> i (*this); i
.ok(); i
++)
85 DOUT
<< "\'" << i
.key() << "\'->" << i
.val ().str () << '\n';
90 Symtables::add (String s
, Symtable
*p
)
93 Dictionary
<Symtable
*>::elem (s
) = p
;