]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/scheme-engraver.hh
Release: bump Welcome versions.
[lilypond.git] / lily / include / scheme-engraver.hh
1 /*
2   scheme-engraver.hh -- declare Scheme_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   Copyright (c) 2009--2015 Han-Wen Nienhuys <hanwen@lilypond.org>
7
8   LilyPond is free software: you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation, either version 3 of the License, or
11   (at your option) any later version.
12
13   LilyPond is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef SCHEME_ENGRAVER_HH
23 #define SCHEME_ENGRAVER_HH
24
25 #include "engraver.hh"
26
27 struct Preinit_Scheme_engraver {
28   SCM initialize_function_;
29   SCM finalize_function_;
30   SCM precomputable_methods_ [TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
31
32   // hashq table of interface-symbol -> scheme-function
33   Drul_array<SCM> interface_acknowledger_hash_;
34
35   // Alist of listened-symbol . scheme-function
36   SCM per_instance_listeners_;
37   Preinit_Scheme_engraver ();
38 };
39
40 class Scheme_engraver : Preinit_Scheme_engraver, public Engraver
41 {
42 public:
43   TRANSLATOR_FAMILY_DECLARATIONS (Scheme_engraver);
44   Scheme_engraver (SCM definition, Context *c);
45
46 protected:
47   ~Scheme_engraver ();
48
49   virtual void initialize ();
50   virtual void finalize ();
51   virtual void derived_mark () const;
52   virtual SCM get_listener_list () const;
53   virtual bool must_be_last () const;
54
55 private:
56   virtual SCM get_acknowledger (SCM sym, Direction start_end)
57   {
58     return generic_get_acknowledger
59       (sym, interface_acknowledger_hash_[start_end]);
60   }
61
62   SCM init_acknowledgers (SCM alist);
63
64   bool must_be_last_;
65 };
66
67 #endif /* SCHEME_ENGRAVER_HH */