]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator.cc
* lily/include/translator.icc: new file.
[lilypond.git] / lily / translator.cc
1 /*
2   translator.cc -- implement Translator
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "translator.hh"
10
11 #include "warn.hh"
12 #include "translator-group.hh"
13 #include "context-def.hh"
14 #include "global-context.hh"
15
16 #include "translator.icc"
17 #include "ly-smobs.icc"
18
19 Translator::~Translator ()
20 {
21 }
22
23 void
24 Translator::init ()
25 {
26   must_be_last_ = false;
27   self_scm_ = SCM_EOL;
28   daddy_context_ = 0;
29   smobify_self ();
30 }
31
32
33 void
34 Translator::process_music ()
35 {
36 }
37
38 void
39 Translator::process_acknowledged ()
40 {
41 }
42
43 Translator::Translator ()
44 {
45   init ();
46 }
47
48 Translator::Translator (Translator const &src)
49 {
50   init ();
51   must_be_last_ = src.must_be_last_;
52 }
53
54 bool
55 Translator::try_music (Music *)
56 {
57   return false;
58 }
59
60 Moment
61 Translator::now_mom () const
62 {
63   return daddy_context_->now_mom ();
64 }
65
66 Output_def *
67 Translator::get_output_def () const
68 {
69   return daddy_context_->get_output_def ();
70 }
71
72 Translator_group *
73 Translator::get_daddy_translator () const
74 {
75   return daddy_context_->implementation ();
76 }
77
78 SCM
79 Translator::internal_get_property (SCM sym) const
80 {
81   return daddy_context_->internal_get_property (sym);
82 }
83
84 void
85 Translator::stop_translation_timestep ()
86 {
87 }
88
89 /*
90   this function has 2 properties
91
92   - It is called before try_music ()
93
94   - It is called before any user information enters the translators.
95   (i.e. any \property or event is not processed yet.)
96 */
97 void
98 Translator::start_translation_timestep ()
99 {
100 }
101
102 void
103 Translator::initialize ()
104 {
105 }
106
107 void
108 Translator::finalize ()
109 {
110 }
111
112 /*
113   SMOBS
114 */
115 SCM
116 Translator::mark_smob (SCM sm)
117 {
118   Translator *me = (Translator *) SCM_CELL_WORD_1 (sm);
119   me->derived_mark ();
120   return SCM_EOL;
121 }
122
123 SCM
124 Translator::translator_description () const
125 {
126   return SCM_EOL;
127 }
128
129 Global_context *
130 Translator::get_global_context () const
131 {
132   return daddy_context_->get_global_context ();
133 }
134
135 Score_context *
136 Translator::get_score_context () const
137 {
138   return daddy_context_->get_score_context ();
139 }
140
141 SCM
142 Translator::static_translator_description ()const
143 {
144   return SCM_EOL;
145 }
146
147 IMPLEMENT_SMOBS (Translator);
148 IMPLEMENT_DEFAULT_EQUAL_P (Translator);
149 IMPLEMENT_TYPE_P (Translator, "ly:translator?");
150
151 bool
152 Translator::must_be_last () const
153 {
154   return must_be_last_;
155 }
156
157 void
158 Translator::derived_mark () const
159 {
160 }
161
162 void
163 Translator::fetch_precomputable_methods (Translator_void_method_ptr ptrs[])
164 {
165   for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
166     ptrs[i] = 0;
167 }
168
169 int
170 Translator::print_smob (SCM s, SCM port, scm_print_state *)
171 {
172   Translator *me = (Translator *) SCM_CELL_WORD_1 (s);
173   scm_puts ("#<Translator ", port);
174   scm_puts (classname (me), port);
175   scm_puts (" >", port);
176   return 1;
177 }
178