]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lilypond-key.cc
Update guile interface.
[lilypond.git] / lily / lilypond-key.cc
index be4c00b50eb75423b47d4796dc0346ed771a6f9d..b75d872699c7d456ef0744e19517ab4b8c9bdaaa 100644 (file)
@@ -10,7 +10,7 @@
 
 Lilypond_grob_key::Lilypond_grob_key (Object_key const *context,
                                      Moment start,
-                                     String name,
+                                     string name,
                                      int disambiguation_count)
 {
   context_ = context;
@@ -22,7 +22,8 @@ Lilypond_grob_key::Lilypond_grob_key (Object_key const *context,
 void
 Lilypond_grob_key::derived_mark () const
 {
-  scm_gc_mark (context_->self_scm ());
+  if (context_)
+    scm_gc_mark (context_->self_scm ());
 }
 
 // todo: reverse order of comparison for efficiency reasons.
@@ -40,7 +41,7 @@ Lilypond_grob_key::do_compare (Object_key const *key) const
   if (c)
     return c;
 
-  c = String::compare (grob_name_, other->grob_name_);
+  c = grob_name_.compare (other->grob_name_);
   if (c)
     return c;
 
@@ -62,7 +63,7 @@ Lilypond_grob_key::as_scheme () const
 {
   return scm_list_4 (context_ ? context_->self_scm () : SCM_BOOL_F,
                     creation_moment_.smobbed_copy (),
-                    scm_makfrom0str (grob_name_.to_str0 ()),
+                    ly_string2scm (grob_name_),
                     scm_from_int (disambiguation_count_));
 }
 
@@ -86,8 +87,8 @@ Lilypond_context_key::derived_mark () const
 
 Lilypond_context_key::Lilypond_context_key (Object_key const *parent,
                                            Moment start,
-                                           String type,
-                                           String id,
+                                           string type,
+                                           string id,
                                            int count)
 {
   disambiguation_count_ = count;
@@ -119,11 +120,11 @@ Lilypond_context_key::do_compare (Object_key const *key) const
   if (c)
     return c;
 
-  c = String::compare (context_name_, other->context_name_);
+  c = context_name_.compare (other->context_name_);
   if (c)
     return c;
 
-  c = String::compare (id_, other->id_);
+  c = id_.compare (other->id_);
   if (c)
     return c;
 
@@ -145,8 +146,8 @@ Lilypond_context_key::as_scheme () const
 {
   return scm_list_5 (parent_context_ ? parent_context_->self_scm () : SCM_BOOL_F,
                     start_moment_.smobbed_copy (),
-                    scm_makfrom0str (context_name_.to_str0 ()),
-                    scm_makfrom0str (id_.to_str0 ()),
+                    ly_string2scm (context_name_),
+                    ly_string2scm (id_),
                     scm_from_int (disambiguation_count_));
 }
 
@@ -176,7 +177,7 @@ Lilypond_general_key::derived_mark () const
 }
 
 Lilypond_general_key::Lilypond_general_key (Object_key const *parent,
-                                           String name,
+                                           string name,
                                            int count)
 {
   parent_ = parent;
@@ -197,7 +198,7 @@ Lilypond_general_key::do_compare (Object_key const *key)const
   else if (other->parent_)
     return 1;
 
-  int c = String::compare (name_, other->name_);
+  int c = name_.compare (other->name_);
   if (c)
     return c;
 
@@ -212,7 +213,7 @@ SCM
 Lilypond_general_key::as_scheme () const
 {
   return scm_list_3 (parent_ ? parent_->self_scm () : SCM_BOOL_F,
-                    scm_makfrom0str (name_.to_str0 ()),
+                    ly_string2scm (name_),
                     scm_from_int (disambiguation_count_));
 }