]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/context.cc
* tex/lilyponddefs.tex (\lyitem): Don't use \topalign to make
[lilypond.git] / lily / context.cc
index d9f4b2ccef424439340af01f85b8b42d621e4a3c..3c75157e8ebb688eb8d0aaa152a1d090e8684053 100644 (file)
@@ -11,7 +11,7 @@
 #include "context-def.hh"
 #include "context.hh"
 #include "warn.hh"
-#include "music-output-def.hh"
+#include "output-def.hh"
 #include "scm-hash.hh"
 #include "main.hh"
 #include "ly-smobs.icc"
@@ -21,16 +21,15 @@ bool
 Context::is_removable () const
 {
   return context_list_ == SCM_EOL && ! iterator_count_ &&
-         !dynamic_cast<Score_context const*> (this)
-    ;
+         !dynamic_cast<Score_context const*> (this);
 }
 
 void
 Context::check_removal ()
 {
-  for (SCM p = context_list_; is_pair (p); p = ly_cdr (p))
+  for (SCM p = context_list_; scm_is_pair (p); p = scm_cdr (p))
     {
-      Context *trg =  unsmob_context (ly_car (p));
+      Context *trg =  unsmob_context (scm_car (p));
 
       trg->check_removal ();
       if (trg->is_removable ())
@@ -175,8 +174,8 @@ Context::find_create_context (SCM n, String id,
 SCM
 Context::default_child_context_name () const
 {
-  return is_pair (accepts_list_)
-    ? ly_car (scm_last_pair (accepts_list_))
+  return scm_is_pair (accepts_list_)
+    ? scm_car (scm_last_pair (accepts_list_))
     : SCM_EOL;
 }
 
@@ -184,7 +183,7 @@ Context::default_child_context_name () const
 bool
 Context::is_bottom_context () const
 {
-  return !is_symbol (default_child_context_name ());
+  return !scm_is_symbol (default_child_context_name ());
 }
 
 Context*
@@ -193,7 +192,7 @@ Context::get_default_interpreter ()
   if (!is_bottom_context ())
     {
       SCM nm = default_child_context_name ();
-      SCM st = get_output_def ()->find_context_def (nm);
+      SCM st = find_context_def (get_output_def (), nm);
 
       Context_def *t = unsmob_context_def (st);
       if (!t)
@@ -245,7 +244,7 @@ bool
 Context::is_alias (SCM sym) const
 {
   if (sym == ly_symbol2scm ("Bottom")
-      && !is_pair (accepts_list_))
+      && !scm_is_pair (accepts_list_))
     return true;
   if (sym == unsmob_context_def (definition_)->get_context_name ())
     return true;
@@ -303,15 +302,15 @@ find_context_below (Context * where,
 {
   if (where->is_alias (type))
     {
-      if (id == "" || where->id_string_ == id)
+      if (id == "" || where->id_string () == id)
        return where;
     }
   
   Context * found = 0;
   for (SCM s = where->children_contexts ();
-       !found && is_pair (s); s = ly_cdr (s))
+       !found && scm_is_pair (s); s = scm_cdr (s))
     {
-      Context * tr = unsmob_context (ly_car (s));
+      Context * tr = unsmob_context (scm_car (s));
 
       found = find_context_below (tr, type, id);
     }
@@ -344,7 +343,7 @@ Context::get_score_context () const
     return 0;
 }
 
-Music_output_def *
+Output_def *
 Context::get_output_def () const
 {
   return  (daddy_context_)
@@ -365,7 +364,7 @@ Context::now_mom () const
 int
 Context::print_smob (SCM s, SCM port, scm_print_state *)
 {
-  Context *sc = (Context *) ly_cdr (s);
+  Context *sc = (Context *) SCM_CELL_WORD_1 (s);
      
   scm_puts ("#<", port);
   scm_puts (classname (sc), port);
@@ -412,7 +411,7 @@ IMPLEMENT_TYPE_P (Context,"ly:context?");
 bool
 Context::try_music (Music* m)
 {
-  Translator*  t = unsmob_translator (implementation_);
+  Translator*  t = implementation ();
   if (!t)
     return false;
   
@@ -442,3 +441,9 @@ Context::get_parent_context () const
 {
   return daddy_context_;
 }
+
+Translator_group*
+Context::implementation () const
+{
+  return dynamic_cast<Translator_group*> (unsmob_translator (implementation_));
+}