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>
14 #include "assoc-iter.hh"
15 #include "symtable.hh"
17 Symtables::Symtables()
22 Symtables::Symtables (Symtables const &s)
23 : Dictionary<Symtable*> (s)
26 font_path_ = s.font_path_;
27 for (Assoc_iter<String, Symtable*> i (s); i.ok(); i++)
29 add (i.key(), new Symtable (*i.val ()));
33 Symtables::~Symtables()
35 for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
42 Symtable::lookup (String s) const
51 warning (_f ("Symtable `%s\': unknown symbol: `%s\'", id_str, s));
58 Symtables::operator()(String s)
62 error (_f ("Symtable `%s\' unknown", s));
64 We can 't return, because we'll dump core anyway.
69 return Dictionary<Symtable*>::operator[](s);
72 Symtables::print() const
74 for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
76 DOUT << "table \'" << i.key () << "\' {\n";
82 Symtable::print() const
84 for (Assoc_iter<String, Atom> i (*this); i.ok(); i++)
86 DOUT << "\'" << i.key() << "\'->" << i.val ().str () << '\n';
91 Symtables::add (String s, Symtable*p)
94 Dictionary<Symtable*>::add (s,p);