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