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