2 scope.cc -- implement Scope
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 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 DOUT << ai.key() << "=";
31 for (Scope_iter ai (*this); ai.ok(); ai++)
33 DOUT << "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 scm_hash (Protected_scm s)
49 return scm_ihashv (s, ~1u);
54 hash_func_ = scm_hash;
58 Scope::elem_b (String s) const
60 return elem_b (ly_symbol (s.ch_C()));
65 Scope::elem (String s)
67 return elem (ly_symbol (s.ch_C()));
71 Scope_iter::Scope_iter (Scope const &s)
72 : Hash_table_iter<Protected_scm,Identifier*>(s)
77 Scope_iter::key () const
79 SCM s= Hash_table_iter<Protected_scm,Identifier*>::key ();
80 return symbol_to_string (s);
84 Scope::elem_b (SCM s) const
86 return Hash_table<Protected_scm,Identifier*> ::elem_b (s);
92 return Hash_table<Protected_scm,Identifier*> ::elem (s);
96 Scope_iter::scm_key () const
98 return Hash_table_iter<Protected_scm,Identifier*>::key ();