]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/scheme-engraver.hh
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/lilypond into
[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 class Scheme_engraver : public Engraver
28 {
29   void init_from_scheme (SCM definition);
30 public:
31   TRANSLATOR_FAMILY_DECLARATIONS (Scheme_engraver);
32   Scheme_engraver (SCM definition);
33
34 protected:
35   ~Scheme_engraver ();
36
37   virtual void initialize ();
38   virtual void finalize ();
39   virtual void derived_mark () const;
40   virtual SCM get_listener_list () const;
41   virtual bool must_be_last () const;
42
43 private:
44   virtual SCM get_acknowledger (SCM sym)
45   {
46     return generic_get_acknowledger (sym, interface_acknowledger_hash_);
47   }
48   virtual SCM get_end_acknowledger (SCM sym)
49   {
50     return generic_get_acknowledger (sym, interface_end_acknowledger_hash_);
51   }
52
53   SCM init_acknowledgers (SCM alist);
54   // For now no description.  In future, something derived from the
55   // definition might make sense.
56   SCM translator_description () const { return SCM_EOL; }
57
58   bool must_be_last_;
59
60   SCM initialize_function_;
61   SCM finalize_function_;
62   SCM precomputable_methods_ [TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
63
64   // hashq table of interface-symbol -> scheme-function
65   SCM interface_acknowledger_hash_;
66   SCM interface_end_acknowledger_hash_;
67
68   // Alist of listened-symbol . scheme-function
69   SCM per_instance_listeners_;
70 };
71
72 #endif /* SCHEME_ENGRAVER_HH */