]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator.cc
patch::: 1.3.108.jcn4
[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::do_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 void
76 Translator::add_processing ()
77 {
78   do_add_processing ();
79 }
80
81 void
82 Translator::do_add_processing ()
83 {
84 }
85
86
87 void
88 Translator::post_move_processing ()
89 {
90   do_post_move_processing ();
91 }
92
93 void
94 Translator::removal_processing ()
95 {
96   do_removal_processing ();
97 }
98
99 bool
100 Translator::try_music (Music * r)
101 {
102   return do_try_music (r);
103 }
104
105 void
106 Translator::announces ()
107 {
108   do_announces ();
109 }
110
111
112 void
113 Translator::pre_move_processing ()
114 {
115   do_pre_move_processing ();
116 }
117
118
119
120 Music_output_def *
121 Translator::output_def_l () const
122 {
123   return output_def_l_;
124 }
125
126 SCM
127 Translator::get_property (char const * id) const
128 {
129   return daddy_trans_l_->get_property (ly_symbol2scm (id));
130 }
131
132 SCM
133 Translator::get_property (SCM sym) const
134 {
135   return daddy_trans_l_->get_property (sym);
136 }
137
138 void
139 Translator:: do_pre_move_processing ()
140 {
141 }
142
143 void
144 Translator::do_post_move_processing ()
145 {
146 }
147
148 void
149 Translator::do_announces ()
150 {
151 }
152
153 void
154 Translator::do_creation_processing ()
155 {
156 }
157
158 void
159 Translator::do_removal_processing ()
160 {
161 }
162
163
164 /*
165
166   SMOBS
167
168 */
169 SCM
170 Translator::mark_smob (SCM sm)
171 {
172   Translator * me = (Translator*) SCM_CELL_WORD_1(sm);
173   scm_gc_mark (me->simple_trans_list_);
174   scm_gc_mark (me->trans_group_list_);
175   scm_gc_mark (me->definition_);  
176   scm_gc_mark (me->properties_scm_);  
177
178   return me->properties_scm_;
179 }
180
181
182 int
183 Translator::print_smob (SCM s, SCM port, scm_print_state *)
184 {
185   Translator *sc = (Translator *) gh_cdr (s);
186      
187   scm_puts ("#<Translator ", port);
188   scm_puts ((char *)sc->name (), port);
189   scm_display (sc->simple_trans_list_, port);
190   /*
191     don't try to print properties, that is too much hassle.
192    */
193   scm_puts (" >", port);
194
195   
196   
197   return 1;
198 }
199
200
201
202 IMPLEMENT_UNSMOB(Translator, translator);
203 IMPLEMENT_SMOBS(Translator);
204 IMPLEMENT_DEFAULT_EQUAL_P(Translator);