Remove docs/default for AccidentalPlacement #'left-padding.
[lilypond/mpolesky.git] / lily / listener.cc
blob686ee3ad67395fa721ec210d2921c45ef2295559
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2005 Erik Sandberg <mandolaerik@gmail.com>
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 "listener.hh"
21 #include "ly-smobs.icc"
22 #include "warn.hh"
24 Listener::Listener ()
26 target_ = 0;
27 type_ = 0;
30 Listener::Listener (const void *target, Listener_function_table *type)
32 target_ = (void *)target;
33 type_ = type;
36 Listener::Listener (Listener const &other)
38 target_ = other.target_;
39 type_ = other.type_;
42 void Listener::listen (SCM ev) const {
43 (type_->listen_callback) (target_, ev);
46 SCM
47 Listener::mark_smob (SCM sm)
49 Listener *me = (Listener *) SCM_CELL_WORD_1 (sm);
50 if (me->type_)
51 (me->type_->mark_callback) (me->target_);
52 return SCM_EOL;
55 int
56 Listener::print_smob (SCM, SCM p, scm_print_state*)
58 scm_puts ("#<Listener>", p);
59 return 1;
62 SCM
63 Listener::equal_p (SCM a, SCM b)
65 Listener *l1 = unsmob_listener (a);
66 Listener *l2 = unsmob_listener (b);
68 return (*l1 == *l2) ? SCM_BOOL_T : SCM_BOOL_F;
71 IMPLEMENT_SIMPLE_SMOBS (Listener);
72 IMPLEMENT_TYPE_P (Listener, "ly:listener?");