2 scope.cc -- implement Scope
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "dictionary-iter.hh"
13 #include "identifier.hh"
14 #include "dictionary.hh"
15 #include "protected-scm.hh"
20 for (Scope_iter ai (*this); ai.ok(); ai++)
25 Scope::Scope (Scope const&s)
27 id_dict_ = new Hash_table<Protected_scm,Identifier*> (*s.id_dict_);
28 for (Scope_iter ai (s); ai.ok(); ai++)
30 id_dict_->elem (ai.scm_key ()) = ai.val ()->clone ();
34 unsigned int ly_pscm_hash (Protected_scm s)
36 return ly_scm_hash (s);
42 id_dict_ = new Hash_table<Protected_scm,Identifier*>;
43 id_dict_->hash_func_ = ly_pscm_hash;
47 Scope::elem_b (String s) const
49 return id_dict_->elem_b (ly_symbol2scm (s.ch_C()));
54 Scope::elem (String s)
56 return id_dict_->elem (ly_symbol2scm (s.ch_C()));
60 Scope_iter::Scope_iter (Scope const &s)
62 iter_ = new Hash_table_iter<Protected_scm,Identifier*>(*s.id_dict_);
66 Scope_iter::key () const
69 return ly_symbol2string (s);
73 Scope::elem_b (SCM s) const
75 return id_dict_->elem_b (s);
81 return id_dict_->elem (s);
85 Scope_iter::scm_key () const
91 Scope_iter::ok () const
97 Scope_iter::operator ++(int)
103 Scope_iter::val ()const
105 return iter_->val ();