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