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