2 scope.cc -- implement Scope
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "dictionary-iter.hh"
13 #include "identifier.hh"
18 bool init_b = false; // ugh
19 for (Scope_iter ai (*this); ai.ok(); ai++)
21 if (ai.val()->init_b_ == init_b)
23 DEBUG_OUT << ai.key() << "=";
31 for (Scope_iter ai (*this); ai.ok(); ai++)
33 DEBUG_OUT << "deleting: " << ai.key() << '\n';
38 Scope::Scope (Scope const&s)
39 : Hash_table<Protected_scm,Identifier*> (s)
41 for (Scope_iter ai (s); ai.ok(); ai++)
43 (*this)[ai.scm_key ()] = ai.val ()->clone ();
47 unsigned int ly_pscm_hash (Protected_scm s)
49 return ly_scm_hash (s);
55 hash_func_ = ly_pscm_hash;
59 Scope::elem_b (String s) const
61 return elem_b (ly_symbol2scm (s.ch_C()));
66 Scope::elem (String s)
68 return elem (ly_symbol2scm (s.ch_C()));
72 Scope_iter::Scope_iter (Scope const &s)
73 : Hash_table_iter<Protected_scm,Identifier*>(s)
78 Scope_iter::key () const
80 SCM s= Hash_table_iter<Protected_scm,Identifier*>::key ();
81 return ly_symbol2string (s);
85 Scope::elem_b (SCM s) const
87 return Hash_table<Protected_scm,Identifier*> ::elem_b (s);
93 return Hash_table<Protected_scm,Identifier*> ::elem (s);
97 Scope_iter::scm_key () const
99 return Hash_table_iter<Protected_scm,Identifier*>::key ();