]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator.cc
2003 -> 2004
[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 output_def_;
79 }
80
81 SCM
82 Translator::internal_get_property (SCM sym) const
83 {
84   return daddy_trans_->internal_get_property (sym);
85 }
86
87 void
88 Translator:: stop_translation_timestep ()
89 {
90 }
91
92 /*
93   this function has 2 properties
94
95   - It is called before try_music()
96
97   - It is called before any user information enters the translators.
98   (i.e. any \property or event is not processed yet.)
99
100   */
101 void
102 Translator::start_translation_timestep ()
103 {
104 }
105
106 void
107 Translator::initialize ()
108 {
109 }
110
111 void
112 Translator::finalize ()
113 {
114 }
115
116
117 /*
118
119   SMOBS
120
121 */
122 SCM
123 Translator::mark_smob (SCM sm)
124 {
125   Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
126   scm_gc_mark (me->simple_trans_list_);
127   scm_gc_mark (me->trans_group_list_);
128   scm_gc_mark (me->definition_);  
129   scm_gc_mark (me->properties_scm_);  
130   scm_gc_mark (me->accepts_list_);
131
132   return me->properties_scm_;
133 }
134
135 SCM
136 Translator::translator_description () const
137 {
138   return SCM_EOL;
139 }
140
141 SCM
142 Translator::static_translator_description ()const
143 {
144   return SCM_EOL;
145 }
146
147
148 IMPLEMENT_SMOBS (Translator);
149 IMPLEMENT_DEFAULT_EQUAL_P (Translator);
150 IMPLEMENT_TYPE_P(Translator,"ly:translator?");
151
152 SCM
153 Translator::get_simple_trans_list()
154 {
155   return SCM_EOL;
156 }