]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/object-key.cc
* flower
[lilypond.git] / lily / object-key.cc
index d912b3d088a60a95963b1a4e0e244d6866d6cfb4..134ff7fb232a3b757e0bc34b3306574bcf59023d 100644 (file)
@@ -4,7 +4,6 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
 */
 
 #include "lilypond-key.hh"
 SCM
 Object_key::mark_smob (SCM key)
 {
-  Object_key* k = (Object_key*) SCM_CELL_WORD_1 (key);
-  k->derived_mark();
+  Object_key *k = (Object_key *) SCM_CELL_WORD_1 (key);
+  k->derived_mark ();
   return SCM_EOL;
 }
 
 void
 Object_key::derived_mark () const
 {
-  
+
 }
 
-Object_key::~Object_key()
+Object_key::~Object_key ()
 {
 }
 
@@ -37,9 +36,9 @@ Object_key::get_type () const
 int
 Object_key::print_smob (SCM smob, SCM port, scm_print_state*)
 {
-  Object_key* k = (Object_key*) SCM_CELL_WORD_1 (smob);
+  Object_key *k = (Object_key *) SCM_CELL_WORD_1 (smob);
   scm_puts ("#<Object_key ", port);
-  scm_display (scm_from_int (k->get_type()), port);
+  scm_display (scm_from_int (k->get_type ()), port);
   scm_puts (">", port);
   return 1;
 }
@@ -54,8 +53,8 @@ Object_key::compare (Object_key const *other) const
 {
   if (this == other)
     return 0;
-  
-  int c = sign (get_type () -  other->get_type());
+
+  int c = sign (get_type () - other->get_type ());
   if (c)
     return c;
   else
@@ -65,11 +64,11 @@ Object_key::compare (Object_key const *other) const
 IMPLEMENT_SMOBS (Object_key);
 
 SCM
-Object_key::equal_p (SCM a , SCM b) 
+Object_key::equal_p (SCM a, SCM b)
 {
   Object_key *ka = unsmob_key (a);
   Object_key *kb = unsmob_key (b);
-  
+
   return (ka->compare (kb)) ? SCM_BOOL_F : SCM_BOOL_T;
 }
 
@@ -79,34 +78,33 @@ Object_key::do_compare (Object_key const *) const
   return 0;
 }
 
-
 SCM
 Object_key::dump () const
 {
-  return scm_cons (scm_from_int (get_type()),
-                  as_scheme());
+  return scm_cons (scm_from_int (get_type ()),
+                  as_scheme ());
 }
 
-
-
 SCM
 Object_key::as_scheme () const
 {
-  return SCM_EOL;  
+  return SCM_EOL;
 }
 
-Object_key*
+Object_key *
 Object_key::from_scheme (SCM)
 {
-  return new Object_key();
+  return new Object_key ();
 }
 
-struct Object_dumper_table_entry {
+struct Object_dumper_table_entry
+{
   Object_key_type type_;
-  Object_key* (*ctor_)(SCM);
+  Object_key *(*ctor_) (SCM);
 };
 
-static Object_dumper_table_entry undumpers[] = {
+static Object_dumper_table_entry undumpers[]
+= {
   {BASE_KEY, Object_key::from_scheme},
   {COPIED_KEY, Copied_key::from_scheme},
   {GENERAL_KEY, Lilypond_general_key::from_scheme},
@@ -120,12 +118,12 @@ Object_key::undump (SCM scm_key)
 {
   int t = scm_to_int (scm_car (scm_key));
   assert (t == undumpers[t].type_);
-  return (undumpers[t].ctor_)(scm_cdr (scm_key)); 
+  return (undumpers[t].ctor_) (scm_cdr (scm_key));
 }
 
 /****************************************************************/
 
-Copied_key::Copied_key (Object_key constkey, int count)
+Copied_key::Copied_key (Object_key const *key, int count)
 {
   copy_count_ = count;
   original_ = key;
@@ -140,8 +138,8 @@ Copied_key::get_type () const
 int
 Copied_key::do_compare (Object_key const *key) const
 {
-  Copied_key const *other = dynamic_cast<Copied_key const*> (key);
-  
+  Copied_key const *other = dynamic_cast < Copied_key const *> (key);
+
   int c = original_->compare (other->original_);
   if (c)
     return c;
@@ -158,13 +156,12 @@ Copied_key::derived_mark () const
 SCM
 Copied_key::as_scheme () const
 {
-  return scm_list_2 (original_ ? original_->self_scm() : SCM_BOOL_F, scm_from_int (copy_count_));
+  return scm_list_2 (original_ ? original_->self_scm () : SCM_BOOL_F, scm_from_int (copy_count_));
 }
 
-
 Object_key *
-Copied_key::from_scheme (SCM a) 
+Copied_key::from_scheme (SCM a)
 {
   return new Copied_key (unsmob_key (scm_car (a)),
-                        scm_to_int  (scm_list_ref (a, scm_from_int (1))));
+                        scm_to_int (scm_list_ref (a, scm_from_int (1))));
 }