]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator.cc
* input/test/piano-staff-distance.ly: 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--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   Translator *t
78     = unsmob_translator (daddy_context_->implementation_);
79   return dynamic_cast<Translator_group*> (t);
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?");