2 object-key.cc -- implement Object_key
4 source file of the GNU LilyPond music typesetter
6 (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "object-key.hh"
12 #include "ly-smobs.icc"
15 Object_key::mark_smob (SCM key)
17 Object_key* k = (Object_key*) SCM_CELL_WORD_1 (key);
23 Object_key::derived_mark () const
28 Object_key::~Object_key()
33 Object_key::get_type () const
39 Object_key::print_smob (SCM smob, SCM port, scm_print_state*)
44 Object_key::Object_key ()
50 Object_key::compare (Object_key const *other) const
55 int c = sign (get_type () - other->get_type());
59 return do_compare (other);
62 IMPLEMENT_SMOBS (Object_key);
65 Object_key::equal_p (SCM a , SCM b)
67 Object_key *ka = unsmob_key (a);
68 Object_key *kb = unsmob_key (b);
70 return (ka->compare (kb)) ? SCM_BOOL_F : SCM_BOOL_T;
74 Object_key::do_compare (Object_key const *other) const
79 /****************************************************************/
81 Copied_key::Copied_key (Object_key const* key, int count)
88 Copied_key::get_type () const
94 Copied_key::do_compare (Object_key const *key) const
96 Copied_key const *other = dynamic_cast<Copied_key const*> (key);
98 int c = original_->compare (other->original_);
102 return sign (copy_count_ - other->copy_count_);
106 Copied_key::derived_mark () const
108 scm_gc_mark (original_->self_scm ());