2 listener.cc -- implement Listener and Listener_target
4 source file of the GNU LilyPond music typesetter
6 (c) 2005 Erik Sandberg <mandolaerik@gmail.com>
10 #include "ly-smobs.icc"
19 Listener::Listener (const void *target
, Listener_function_table
*type
)
21 target_
= (void *)target
;
25 Listener::Listener (Listener
const &other
)
27 target_
= other
.target_
;
31 void Listener::listen (SCM ev
) const {
32 (type_
->listen_callback
) (target_
, ev
);
36 Listener::mark_smob (SCM sm
)
38 Listener
*me
= (Listener
*) SCM_CELL_WORD_1 (sm
);
40 (me
->type_
->mark_callback
) (me
->target_
);
45 Listener::print_smob (SCM
, SCM p
, scm_print_state
*)
47 scm_puts ("#<Listener>", p
);
52 Listener::equal_p (SCM a
, SCM b
)
54 Listener
*l1
= unsmob_listener (a
);
55 Listener
*l2
= unsmob_listener (b
);
57 return (*l1
== *l2
) ? SCM_BOOL_T
: SCM_BOOL_F
;
60 IMPLEMENT_SIMPLE_SMOBS (Listener
);
61 IMPLEMENT_TYPE_P (Listener
, "ly:listener?");