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_
))
27 id_dict_
= new Scheme_hash_table
;
31 Scope::elem_b (String s
) const
33 return id_dict_
->elem_b (ly_symbol2scm (s
.ch_C()));
38 Scope::elem_b (SCM s
) const
40 return id_dict_
->elem_b (s
);
43 Scope::elem (SCM s
)const
45 return unsmob_identifier (id_dict_
->get (s
));
49 Scope::scm_elem (SCM s
)const
51 return id_dict_
->get (s
);
55 Scope::scm_elem (String s
) const
57 return scm_elem (ly_symbol2scm (s
.ch_C()));
61 Scope::elem (String s
)const
63 return elem (ly_symbol2scm (s
.ch_C()));
67 Scope::set (String s
, SCM id
)
69 return id_dict_
->set (ly_symbol2scm (s
.ch_C()), id
);
73 Scope::set (String s
, Identifier
* id
)
75 return id_dict_
->set (ly_symbol2scm (s
.ch_C()), smobify (id
));
79 Scope::to_alist () const
81 return id_dict_
->to_alist ();