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>
9 #include "translator-dispatch-list.hh"
10 #include "engraver.hh"
12 #include "ly-smobs.icc"
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
)
24 (*e
.function_
) (e
.engraver_
, gi
);
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
;
37 for (SCM s
= trans_list
; scm_is_pair (s
); s
= scm_cdr (s
))
40 = dynamic_cast<Engraver
*> (unsmob_translator (scm_car (s
)));
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
));
55 entry
.function_
= ptr
;
56 list
->dispatch_entries_
.push_back (entry
);
62 return found
? retval
: SCM_EOL
;
66 Engraver_dispatch_list::mark_smob (SCM
)
72 Engraver_dispatch_list::print_smob (SCM
/* x */,
76 scm_puts ("#<Engraver_dispatch_list>", p
);
80 IMPLEMENT_SIMPLE_SMOBS (Engraver_dispatch_list
);
81 IMPLEMENT_DEFAULT_EQUAL_P (Engraver_dispatch_list
);