]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator.cc
* flower
[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 "ly-smobs.icc"
17
18 Translator::~Translator ()
19 {
20 }
21
22 void
23 Translator::init ()
24 {
25   must_be_last_ = false;
26   self_scm_ = SCM_EOL;
27   daddy_context_ = 0;
28   smobify_self ();
29 }
30
31 void
32 Translator::do_announces ()
33 {
34 }
35
36 void
37 Translator::process_music ()
38 {
39
40 }
41
42 Translator::Translator ()
43 {
44   init ();
45 }
46
47 Translator::Translator (Translator const &src)
48 {
49   init ();
50   must_be_last_ = src.must_be_last_;
51 }
52
53 bool
54 Translator::try_music (Music *)
55 {
56   return false;
57 }
58
59 Moment
60 Translator::now_mom () const
61 {
62   return daddy_context_->now_mom ();
63 }
64
65 Output_def *
66 Translator::get_output_def () const
67 {
68   return daddy_context_->get_output_def ();
69 }
70
71 Translator_group *
72 Translator::get_daddy_translator () const
73 {
74   return daddy_context_->implementation ();
75 }
76
77 SCM
78 Translator::internal_get_property (SCM sym) const
79 {
80   return daddy_context_->internal_get_property (sym);
81 }
82
83 void
84 Translator::stop_translation_timestep ()
85 {
86 }
87
88 /*
89   this function has 2 properties
90
91   - It is called before try_music ()
92
93   - It is called before any user information enters the translators.
94   (i.e. any \property or event is not processed yet.)
95 */
96 void
97 Translator::start_translation_timestep ()
98 {
99 }
100
101 void
102 Translator::initialize ()
103 {
104 }
105
106 void
107 Translator::finalize ()
108 {
109 }
110
111 /*
112   SMOBS
113 */
114 SCM
115 Translator::mark_smob (SCM sm)
116 {
117   Translator *me = (Translator *) SCM_CELL_WORD_1 (sm);
118   me->derived_mark ();
119   return SCM_EOL;
120 }
121
122 SCM
123 Translator::translator_description () const
124 {
125   return SCM_EOL;
126 }
127
128 Global_context *
129 Translator::get_global_context () const
130 {
131   return daddy_context_ ->get_global_context ();
132 }
133
134 Score_context *
135 Translator::get_score_context () const
136 {
137   return daddy_context_->get_score_context ();
138 }
139
140 SCM
141 Translator::static_translator_description ()const
142 {
143   return SCM_EOL;
144 }
145
146 IMPLEMENT_SMOBS (Translator);
147 IMPLEMENT_DEFAULT_EQUAL_P (Translator);
148 IMPLEMENT_TYPE_P (Translator, "ly:translator?");
149
150 bool
151 Translator::must_be_last () const
152 {
153   return must_be_last_;
154 }
155
156 void
157 Translator::derived_mark () const
158 {
159
160 }