]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/translator-dispatch-list.cc
Run grand replace for 2015.
[lilypond.git] / lily / translator-dispatch-list.cc
index 11d3d62166f9795c8d680685880eeb91965ec401..5174bb33d3859129ab6386520b36e4e61ef07f1c 100644 (file)
@@ -1,83 +1,73 @@
 /*
-  translator-dispatch-list.cc -- implement Translator_dispatch_list
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 2005--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 2005 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
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
 
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "translator-dispatch-list.hh"
-
-#include "grob-info.hh"
 #include "engraver.hh"
 
-#include "ly-smobs.icc"
 
-void 
+void
 Engraver_dispatch_list::apply (Grob_info gi)
 {
-  for (int i = 0; i < dispatch_entries_.size (); i++)
+  Translator *origin = gi.origin_translator ();
+  for (vsize i = 0; i < dispatch_entries_.size (); i++)
     {
       Engraver_dispatch_entry const &e (dispatch_entries_[i]);
-      if (e.engraver_ == gi.origin_translator ())
-       continue; 
+      if (e.engraver_ == origin)
+        continue;
 
-      (*e.function_) (e.engraver_, gi);
+      (e.engraver_->*e.function_) (gi);
     }
 }
 
 SCM
 Engraver_dispatch_list::create (SCM trans_list,
-                               SCM iface_list)
+                                SCM iface_list, Direction start_end)
 {
-  SCM retval = Engraver_dispatch_list().smobbed_copy ();
-  Engraver_dispatch_list * list = Engraver_dispatch_list::unsmob (retval);
+  SCM retval = Engraver_dispatch_list ().smobbed_copy ();
+  Engraver_dispatch_list *list = Engraver_dispatch_list::unsmob (retval);
 
   Engraver_dispatch_entry entry;
-  bool found = false; 
+  bool found = false;
   for (SCM s = trans_list; scm_is_pair (s); s = scm_cdr (s))
     {
-      Engraver * eng
-       = dynamic_cast<Engraver*> (unsmob_translator (scm_car (s)));
+      Engraver *eng
+        = dynamic_cast<Engraver *> (Translator::unsmob (scm_car (s)));
 
       if (!eng)
-       continue;
+        continue;
 
       entry.engraver_ = eng;
-      for (SCM i =  iface_list; scm_is_pair (i); i = scm_cdr (i))
-       {
-         Engraver_void_function_engraver_grob_info ptr
-           = eng->get_acknowledger (scm_car (i));
-         if (ptr)
-           {
-             entry.function_ = ptr;
-             list->dispatch_entries_.push (entry);
-             found = true;
-           }
-         
-       }
+      for (SCM i = iface_list; scm_is_pair (i); i = scm_cdr (i))
+        {
+          Engraver_void_function_engraver_grob_info ptr
+            = (start_end == START)
+              ? eng->get_acknowledger (scm_car (i))
+              : eng->get_end_acknowledger (scm_car (i));
+
+          if (ptr)
+            {
+              entry.function_ = ptr;
+              list->dispatch_entries_.push_back (entry);
+              found = true;
+            }
+        }
     }
 
-  
-  return found ? retval : SCM_BOOL_F;
-}
-
-SCM
-Engraver_dispatch_list::mark_smob (SCM x)
-{
-  (void)x;
-  return SCM_BOOL_F;
+  return found ? retval : SCM_EOL;
 }
-
-
-int
-Engraver_dispatch_list::print_smob (SCM x, SCM p, scm_print_state *)
-{
-  (void)x;
-  scm_puts ("#<Engraver_dispatch_list>", p);
-  return 1;
-}
-
-IMPLEMENT_SIMPLE_SMOBS(Engraver_dispatch_list);
-IMPLEMENT_DEFAULT_EQUAL_P(Engraver_dispatch_list);