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