]> git.donarmstrong.com Git - lilypond.git/blob - lily/translator.cc
* lily/include/grob-info.hh: origin_contexts() now does not
[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 #include "global-context.hh"
15 #include "moment.hh"
16 #include "context.hh"
17 #include "ly-smobs.icc"
18
19
20 Translator::~Translator ()
21 {
22 }
23
24 void
25 Translator::init ()
26 {
27   self_scm_ = SCM_EOL;
28   simple_trans_list_ = SCM_BOOL_F;
29   daddy_context_ =0;
30   smobify_self ();
31 }
32
33 Translator::Translator ()
34 {
35   init ();
36 }
37
38 Translator::Translator (Translator const &)
39 {
40   init ();
41 }
42
43 bool
44 Translator::try_music (Music *)
45 {
46   return false;
47 }
48                             
49
50 Moment
51 Translator::now_mom () const
52 {
53   return daddy_context_->now_mom ();
54 }
55
56 Music_output_def *
57 Translator::get_output_def () const
58 {
59   return daddy_context_->get_output_def ();
60 }
61
62
63 Translator_group*
64 Translator::get_daddy_translator () const
65 {
66   Translator *t
67     = unsmob_translator (daddy_context_->implementation_);
68   return dynamic_cast<Translator_group*> (t);
69 }
70
71
72 SCM
73 Translator::internal_get_property (SCM sym) const
74 {
75   return daddy_context_->internal_get_property (sym);
76 }
77
78 void
79 Translator::stop_translation_timestep ()
80 {
81 }
82
83 /*
84   this function has 2 properties
85
86   - It is called before try_music()
87
88   - It is called before any user information enters the translators.
89   (i.e. any \property or event is not processed yet.)
90
91   */
92 void
93 Translator::start_translation_timestep ()
94 {
95 }
96
97 void
98 Translator::initialize ()
99 {
100 }
101
102 void
103 Translator::finalize ()
104 {
105 }
106
107
108 /*
109
110   SMOBS
111
112 */
113 SCM
114 Translator::mark_smob (SCM sm)
115 {
116   Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
117   return me->simple_trans_list_;
118 }
119
120 SCM
121 Translator::translator_description () const
122 {
123   return SCM_EOL;
124 }
125
126
127 Global_context *
128 Translator::get_global_context () const
129 {
130   return daddy_context_ ->get_global_context ();
131 }
132
133
134 Score_context *
135 Translator::get_score_context () const
136 {
137   return daddy_context_->get_score_context ();
138 }  
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?");