]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator.cc
release: 1.3.110
[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--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #include "translator.hh"
11 #include "debug.hh"
12 #include "translator-group.hh"
13
14 #include "moment.hh"
15 #include "ly-smobs.icc"
16
17 char const*
18 Translator::name() const
19 {
20   return classname(this);
21 }
22
23 Translator::~Translator ()
24 {
25 }
26
27 void
28 Translator::init ()
29 {
30   simple_trans_list_ = SCM_EOL;
31   trans_group_list_ = SCM_EOL;
32   properties_scm_ = SCM_EOL;
33   definition_ = SCM_EOL;
34   daddy_trans_l_ =0;
35 }
36
37 Translator::Translator ()
38 {
39   init ();
40   output_def_l_ = 0;
41   smobify_self ();
42
43 }
44
45 Translator::Translator (Translator const &s)
46   : Input (s)
47 {
48   init ();
49   output_def_l_ = s.output_def_l_;
50   type_str_ = s.type_str_;
51
52   smobify_self ();
53 }
54
55 bool
56 Translator::is_alias_b (String s) const
57 {
58   return s == type_str_;
59 }
60
61 bool
62 Translator::try_music (Music *)
63 {
64   return false;
65 }
66                             
67
68 Moment
69 Translator::now_mom () const
70 {
71   return daddy_trans_l_->now_mom ();
72 }
73
74
75
76
77
78 void
79 Translator::post_move_processing ()
80 {
81   start_translation_timestep ();
82 }
83
84 void
85 Translator::removal_processing ()
86 {
87   finalize ();
88 }
89
90
91 void
92 Translator::announces ()
93 {
94   do_announces ();
95 }
96
97
98 void
99 Translator::pre_move_processing ()
100 {
101   stop_translation_timestep ();
102 }
103
104
105
106 Music_output_def *
107 Translator::output_def_l () const
108 {
109   return output_def_l_;
110 }
111
112 SCM
113 Translator::get_property (char const * id) const
114 {
115   return daddy_trans_l_->get_property (ly_symbol2scm (id));
116 }
117
118 SCM
119 Translator::get_property (SCM sym) const
120 {
121   return daddy_trans_l_->get_property (sym);
122 }
123
124 void
125 Translator:: stop_translation_timestep ()
126 {
127 }
128
129 void
130 Translator::start_translation_timestep ()
131 {
132 }
133
134 void
135 Translator::do_announces ()
136 {
137 }
138
139 void
140 Translator::initialize ()
141 {
142 }
143
144 void
145 Translator::finalize ()
146 {
147 }
148
149
150 /*
151
152   SMOBS
153
154 */
155 SCM
156 Translator::mark_smob (SCM sm)
157 {
158   Translator * me = (Translator*) SCM_CELL_WORD_1(sm);
159   scm_gc_mark (me->simple_trans_list_);
160   scm_gc_mark (me->trans_group_list_);
161   scm_gc_mark (me->definition_);  
162   scm_gc_mark (me->properties_scm_);  
163
164   return me->properties_scm_;
165 }
166
167
168 int
169 Translator::print_smob (SCM s, SCM port, scm_print_state *)
170 {
171   Translator *sc = (Translator *) gh_cdr (s);
172      
173   scm_puts ("#<Translator ", port);
174   scm_puts ((char *)sc->name (), port);
175   scm_display (sc->simple_trans_list_, port);
176   /*
177     don't try to print properties, that is too much hassle.
178    */
179   scm_puts (" >", port);
180
181   
182   
183   return 1;
184 }
185
186
187
188 IMPLEMENT_UNSMOB(Translator, translator);
189 IMPLEMENT_SMOBS(Translator);
190 IMPLEMENT_DEFAULT_EQUAL_P(Translator);