2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2005--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "translator-dispatch-list.hh"
21 #include "engraver.hh"
24 const char * const Engraver_dispatch_list::type_p_name_ = 0;
27 Engraver_dispatch_list::apply (Grob_info gi)
29 SCM origin = gi.origin_translator ()->self_scm ();
30 SCM grob = gi.grob ()->self_scm ();
31 for (vsize i = 0; i < dispatch_entries_.size (); i++)
33 Method_instance const &e (dispatch_entries_[i]);
34 if (scm_is_eq (e.instance (), origin))
42 Engraver_dispatch_list::create (SCM trans_list,
43 SCM iface_list, Direction start_end)
45 SCM retval = Engraver_dispatch_list ().smobbed_copy ();
46 Engraver_dispatch_list *list = unsmob<Engraver_dispatch_list> (retval);
48 for (SCM s = trans_list; scm_is_pair (s); s = scm_cdr (s))
50 Engraver *eng = unsmob<Engraver> (scm_car (s));
55 for (SCM i = iface_list; scm_is_pair (i); i = scm_cdr (i))
57 SCM ptr = eng->get_acknowledger (scm_car (i), start_end);
59 if (!SCM_UNBNDP (ptr))
60 list->dispatch_entries_.push_back (Method_instance (ptr, eng));
64 return list->dispatch_entries_.empty () ? SCM_EOL : retval;