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>
10 #include "dimension.hh"
15 #include "assoc-iter.hh"
16 #include "symtable.hh"
18 Symtables::Symtables()
23 Symtables::Symtables (Symtables const &s)
24 : Dictionary<Symtable*> (s)
27 font_path_ = s.font_path_;
28 for (Assoc_iter<String, Symtable*> i (s); i.ok(); i++)
30 add (i.key(), new Symtable (*i.val ()));
34 Symtables::~Symtables()
36 for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
43 Symtable::lookup (String s) const
52 warning (_f ("Symtable `%s\': unknown symbol: `%s\'", id_str, s));
59 Symtables::operator()(String s)
63 error (_f ("Symtable `%s\' unknown", s));
65 We can 't return, because we'll dump core anyway.
70 return Dictionary<Symtable*>::operator[](s);
73 Symtables::print() const
75 for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
77 DOUT << "table \'" << i.key () << "\' {\n";
83 Symtable::print() const
85 for (Assoc_iter<String, Atom> i (*this); i.ok(); i++)
87 DOUT << "\'" << i.key() << "\'->" << i.val ().str () << '\n';
92 Symtables::add (String s, Symtable*p)
95 Dictionary<Symtable*>::add (s,p);