]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/symtable.cc
release: 1.0.17
[lilypond.git] / lily / symtable.cc
index 52ef9fefc0a716ef5f2f41b18082d623d95157cf..cc3cecff23140339de16c96438dcf0fd18466a37 100644 (file)
@@ -3,16 +3,14 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "misc.hh"
-#include "dimen.hh"
 #include "debug.hh"
 #include "real.hh"
 #include "atom.hh"
-#include "assoc.hh"
-#include "assoc-iter.hh"
+#include "dictionary-iter.hh"
 #include "symtable.hh"
 
 Symtables::Symtables()
@@ -23,7 +21,9 @@ Symtables::Symtables()
 Symtables::Symtables (Symtables const &s)
   : Dictionary<Symtable*> (s)
 {
-  for (Assoc_iter<String, Symtable*>  i (s); i.ok(); i++)
+  font_ = s.font_;
+  font_path_ = s.font_path_;
+  for (Dictionary_iter< Symtable*>  i (s); i.ok(); i++)
     {
       add (i.key(), new Symtable (*i.val ()));
     }
@@ -31,7 +31,7 @@ Symtables::Symtables (Symtables const &s)
 
 Symtables::~Symtables()
 {
-  for (Assoc_iter<String, Symtable*>  i (*this); i.ok(); i++)
+  for (Dictionary_iter< Symtable*>  i (*this); i.ok(); i++)
     {
       delete i.val();
     }
@@ -40,11 +40,14 @@ Symtables::~Symtables()
 Atom
 Symtable::lookup (String s) const
 {
-  if (elt_b (s))
-    return (*this)[s];
+  if (elem_b (s))
+    {
+      Atom a (elem(s));
+      return a;
+    }
   else
     {
-      warning ("Symtable `" + id_str+ _("\': unknown symbol `") +s+"'\n");
+      warning (_f ("Symtable `%s\': unknown symbol: `%s\'", id_str, s));
       Atom sy;
       return sy;
     }
@@ -53,11 +56,11 @@ Symtable::lookup (String s) const
 Symtable*
 Symtables::operator()(String s)
 {
-  if (!elt_b (s))
+  if (!elem_b (s))
     {
-      error ("Symtable `" + s + _("\' unknown"));
+      error (_f ("Symtable `%s\' unknown", s));
       /* 
-        We can't return, because we'll dump core anyway.
+        We can 't return, because we'll dump core anyway.
        */
       return 0;
     }
@@ -67,9 +70,9 @@ Symtables::operator()(String s)
 void
 Symtables::print() const
 {
-  for (Assoc_iter<String, Symtable*>  i (*this); i.ok(); i++)
+  for (Dictionary_iter<Symtable*>  i (*this); i.ok(); i++)
     {
-      DOUT << "table \'" << i.key() << "\' {\n";
+      DOUT << "table \'" << i.key () << "\' {\n";
       i.val()->print ();
       DOUT << "}\n";
     }
@@ -77,9 +80,9 @@ Symtables::print() const
 void
 Symtable::print() const
 {
-  for (Assoc_iter<String, Atom>  i (*this); i.ok(); i++)
+  for (Dictionary_iter<Atom>  i (*this); i.ok(); i++)
     {
-      DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
+      DOUT << "\'" << i.key() << "\'->" << i.val ().str () << '\n';
     }
 }
 
@@ -87,5 +90,5 @@ void
 Symtables::add (String s, Symtable*p)
 {
   p-> id_str = s;
-  Dictionary<Symtable*>::add (s,p);
+  Dictionary<Symtable*>::elem  (s) = p;
 }