Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / translator-dispatch-list.cc
blobbf8c70e0038975943bfcf13d6d2b47373398d9d0
1 /*
2 translator-dispatch-list.cc -- implement Translator_dispatch_list
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "translator-dispatch-list.hh"
10 #include "engraver.hh"
12 #include "ly-smobs.icc"
14 void
15 Engraver_dispatch_list::apply (Grob_info gi)
17 Translator *origin = gi.origin_translator ();
18 for (vsize i = 0; i < dispatch_entries_.size (); i++)
20 Engraver_dispatch_entry const &e (dispatch_entries_[i]);
21 if (e.engraver_ == origin)
22 continue;
24 (*e.function_) (e.engraver_, gi);
28 SCM
29 Engraver_dispatch_list::create (SCM trans_list,
30 SCM iface_list, Direction start_end)
32 SCM retval = Engraver_dispatch_list ().smobbed_copy ();
33 Engraver_dispatch_list *list = Engraver_dispatch_list::unsmob (retval);
35 Engraver_dispatch_entry entry;
36 bool found = false;
37 for (SCM s = trans_list; scm_is_pair (s); s = scm_cdr (s))
39 Engraver *eng
40 = dynamic_cast<Engraver *> (unsmob_translator (scm_car (s)));
42 if (!eng)
43 continue;
45 entry.engraver_ = eng;
46 for (SCM i = iface_list; scm_is_pair (i); i = scm_cdr (i))
48 Engraver_void_function_engraver_grob_info ptr
49 = (start_end == START)
50 ? eng->get_acknowledger (scm_car (i))
51 : eng->get_end_acknowledger (scm_car (i));
53 if (ptr)
55 entry.function_ = ptr;
56 list->dispatch_entries_.push_back (entry);
57 found = true;
62 return found ? retval : SCM_EOL;
65 SCM
66 Engraver_dispatch_list::mark_smob (SCM)
68 return SCM_BOOL_F;
71 int
72 Engraver_dispatch_list::print_smob (SCM /* x */,
73 SCM p,
74 scm_print_state *)
76 scm_puts ("#<Engraver_dispatch_list>", p);
77 return 1;
80 IMPLEMENT_SIMPLE_SMOBS (Engraver_dispatch_list);
81 IMPLEMENT_DEFAULT_EQUAL_P (Engraver_dispatch_list);