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 "identifier.hh"
12 #include "scm-hash.hh"
20 Scope::Scope (Scope const&s)
21 : id_dict_ (new Scheme_hash_table (*s.id_dict_))
24 cloning not necessary.
26 id_dict_ = new Hash_table<Protected_scm,Identifier*> (*s.id_dict_);
27 for (Scope_iter ai (s); ai.ok(); ai++)
29 id_dict_->elem (ai.scm_key ()) = ai.val ()->clone ();
36 id_dict_ = new Scheme_hash_table;
40 Scope::elem_b (String s) const
42 return id_dict_->elem_b (ly_symbol2scm (s.ch_C()));
47 Scope::elem_b (SCM s) const
49 return id_dict_->elem_b (s);
52 Scope::elem (SCM s)const
54 return unsmob_identifier (id_dict_->get (s));
57 Scope::elem (String s)const
59 return elem (ly_symbol2scm (s.ch_C()));
63 Scope::set (String s, Identifier * id)
65 return id_dict_->set (ly_symbol2scm (s.ch_C()), smobify (id));
69 Scope::to_alist () const
71 return id_dict_->to_alist ();