]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/context.cc
Replace C++ (in)equality checks with proper SCM syntax
[lilypond.git] / lily / context.cc
index 3128f5955ade258df4531381b57a2237e7143052..9dad38f269c623a9264966ebee9d1cd381ad0357 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2004--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2004--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@
 bool
 Context::is_removable () const
 {
-  return context_list_ == SCM_EOL && ! client_count_
+  return scm_is_null (context_list_) && ! client_count_
          && !dynamic_cast<Global_context const *> (daddy_context_);
 }
 
@@ -56,11 +56,6 @@ Context::check_removal ()
     }
 }
 
-Context::Context (Context const & /* src */)
-{
-  assert (false);
-}
-
 Scheme_hash_table *
 Context::properties_dict () const
 {
@@ -186,7 +181,7 @@ Context::find_create_context (SCM n, const string &id, SCM operations)
   if (Context *existing = find_context_below (this, n, id))
     return existing;
 
-  if (n == ly_symbol2scm ("Bottom"))
+  if (scm_is_eq (n, ly_symbol2scm ("Bottom")))
     {
       Context *tg = get_default_interpreter (id);
       return tg;
@@ -253,7 +248,7 @@ Context::set_property_from_event (SCM sev)
         unset_property (sym);
         return;
       }
-          
+
       bool ok = true;
       ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
 
@@ -346,7 +341,7 @@ Context::path_to_acceptable_context (SCM name) const
   // but the Context_def expects to see elements of the form ('accepts symbol).
   SCM accepts = SCM_EOL;
   for (SCM s = definition_mods_; scm_is_pair (s); s = scm_cdr (s))
-    if (scm_caar (s) == ly_symbol2scm ("accepts"))
+    if (scm_is_eq (scm_caar (s), ly_symbol2scm ("accepts")))
       {
         SCM elt = scm_list_2 (scm_caar (s), scm_string_to_symbol (scm_cadar (s)));
         accepts = scm_cons (elt, accepts);
@@ -519,7 +514,7 @@ Context::is_alias (SCM sym) const
   if (scm_is_eq (sym, context_name_symbol ()))
     return true;
 
-  return scm_c_memq (sym, aliases_) != SCM_BOOL_F;
+  return scm_is_true (scm_c_memq (sym, aliases_));
 }
 
 void
@@ -663,27 +658,25 @@ Context::now_mom () const
 }
 
 int
-Context::print_smob (SCM s, SCM port, scm_print_state *)
+Context::print_smob (SCM port, scm_print_state *)
 {
-  Context *sc = (Context *) SCM_CELL_WORD_1 (s);
-
   scm_puts ("#<", port);
-  scm_puts (sc->class_name (), port);
-  if (Context_def *d = Context_def::unsmob (sc->definition_))
+  scm_puts (class_name (), port);
+  if (Context_def *d = Context_def::unsmob (definition_))
     {
       scm_puts (" ", port);
       scm_display (d->get_context_name (), port);
     }
 
-  if (!sc->id_string_.empty ())
+  if (!id_string_.empty ())
     {
       scm_puts ("=", port);
-      scm_puts (sc->id_string_.c_str (), port);
+      scm_puts (id_string_.c_str (), port);
     }
 
   scm_puts (" ", port);
 
-  scm_display (sc->context_list_, port);
+  scm_display (context_list_, port);
   scm_puts (" >", port);
 
   return 1;