2004-01-11 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/translator-def.cc: rename Translator_def to Context_def.
+
* Documentation/user/internals.itely (Lexical details): clarify
string def.
When using @code{merge-differently-headed} with an upstem 8th or a shorter
note, and a downstem half note, the 8th note gets the wrong offset.
+There is no support for clusters where the same note occurs with
+different accidentals in the same chord. In this case, it is
+recommended to use enharmonic transcription, or to use special cluster
+notation (see @ref{Clusters}).
+
@node Beaming
@section Beaming
@end example
This means that @var{musicexpr} is transposed by the interval
-between @var{from} and @var{to}.
+between the pitches @var{from} and @var{to}.
+Since @var{from} and @var{to} are pitches, @code{\transpose} must be
+inside a @code{\notes} section.
@code{\transpose} distinguishes between enharmonic pitches: both
@code{\transpose c cis} or @code{\transpose c des} will transpose up
}}
@end lilypond
+
@seealso
Internals: @internalsref{TransposedMusic}, and
\property Score.timing = ##f
\property Score.barAlways = ##t
s_\markup { "$\\backslash$time 4/4" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural4/4" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural4/4" }
s
s_\markup { "$\\backslash$time 2/2" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural2/2" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural2/2" }
s
s_\markup { "$\\backslash$time 6/4" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural6/4" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural6/4" }
s
s_\markup { "$\\backslash$time 6/8" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural6/8" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural6/8" }
\break
s_\markup { "$\\backslash$time 3/2" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural3/2" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural3/2" }
s
s_\markup { "$\\backslash$time 3/4" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural3/4" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural3/4" }
s
s_\markup { "$\\backslash$time 9/4" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural9/4" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural9/4" }
s
s_\markup { "$\\backslash$time 9/8" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural9/8" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural9/8" }
\break
s_\markup { "$\\backslash$time 4/8" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural4/8" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural4/8" }
s
s_\markup { "$\\backslash$time 2/4" }
- ^\markup { " " \musicglyph #"timesig-neo\_mensural2/4" }
+ ^\markup { " " \musicglyph #"timesig-neo_mensural2/4" }
\break
}
\paper {
count += 1
## \musicglyph and \markup require "_" to be escaped differently:
- musicglyphname=re.sub('_','\\\\_', m['name'])
- markupname=re.sub('_','\\\\_', musicglyphname)
+
+ scm_string = re.sub('_', r'_', m['name'])
+ tex_string = re.sub ('_', r'\\_' , m['name'])
+
## prevent TeX from interpreting "--" as long dash:
- markupname=re.sub('--','-{}-', markupname)
+ tex_string=re.sub('--','-{}-', tex_string)
- file.write (' s^\\markup { \\musicglyph #"%s" "%s" }\n' % (musicglyphname, markupname))
+ file.write (' s^\\markup { \\musicglyph #"%s" "%s" }\n' % (scm_string, tex_string))
if (count % 3) ==0:
file.write (' \\break\n')
/*
- translator-def.hh -- declare Translator_def
+ translator-def.hh -- declare Context_def
source file of the GNU LilyPond music typesetter
The definition of a interpretation context as given in the
input. The lists are stored in order of definition.
*/
-struct Translator_def : public Input
+struct Context_def : public Input
{
private:
/*
SCM get_translator_names (SCM) const;
void set_acceptor (SCM accepts, bool add);
- Link_array<Translator_def> path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const;
+ Link_array<Context_def> path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const;
Translator_group * instantiate (Music_output_def*, SCM extra_ops);
SCM to_alist () const;
SCM clone_scm ()const;
void apply_default_property_operations (Translator_group*);
private:
- DECLARE_SMOBS (Translator_def,foo);
- Translator_def ();
- Translator_def (Translator_def const&);
+ DECLARE_SMOBS (Context_def,foo);
+ Context_def ();
+ Context_def (Context_def const&);
};
-DECLARE_UNSMOB(Translator_def,translator_def);
+DECLARE_UNSMOB(Context_def,context_def);
#endif /* TRANSLATOR_DEF_HH */
bool melisma_busy (Translator* tr); // where to put this? --hwn
void apply_property_operations (Translator_group*tg, SCM pre_init_ops);
+SCM names_to_translators (SCM namelist, Translator_group*tg);
#endif // TRANSLATOR_GROUP_HH
protected: // should be private.
SCM simple_trans_list_;
-
- // ugr.
+ friend class Context_def;
+ // ugir.
// friend SCM Translator_group::get_simple_trans_list ();
virtual void process_music ();
};
-
-
Instrument_name_engraver::Instrument_name_engraver ()
{
text_ = 0;
void
Music_output_def::assign_translator (SCM transdef)
{
- Translator_def *tp = unsmob_translator_def (transdef);
+ Context_def *tp = unsmob_context_def (transdef);
assert (tp);
translator_tab_->set (tp->get_context_name (), transdef);
Music_output_def::get_global_translator ()
{
SCM key = ly_symbol2scm ("Score");
- Translator_def * t = unsmob_translator_def (find_translator (key));
+ Context_def * t = unsmob_context_def (find_translator (key));
if (!t)
error (_f ("can't find `%s' context", "Score"));
SCM l = SCM_EOL;
for (SCM s = al ; gh_pair_p (s); s = ly_cdr (s))
{
- Translator_def * td = unsmob_translator_def (ly_cdar (s));
+ Context_def * td = unsmob_context_def (ly_cdar (s));
l = gh_cons (gh_cons (ly_caar (s), td->to_alist ()), l);
}
return l;
translator_spec_body:
/**/ {
$$ = Translator_def::make_scm ();
- unsmob_translator_def ($$)->set_spot (THIS->here_input ());
+ unsmob_context_def ($$)->set_spot (THIS->here_input ());
}
| TRANSLATOR_IDENTIFIER {
$$ = $1;
- unsmob_translator_def ($$)->set_spot (THIS->here_input ());
+ unsmob_context_def ($$)->set_spot (THIS->here_input ());
}
| translator_spec_body GROBDESCRIPTIONS embedded_scm {
- Translator_def*td = unsmob_translator_def($$);
+ Translator_def*td = unsmob_context_def($$);
for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p)) {
SCM tag = gh_caar (p);
}
}
| translator_spec_body context_mod {
- unsmob_translator_def ($$)->add_context_mod ($2);
+ unsmob_context_def ($$)->add_context_mod ($2);
}
;
} else if (gh_number_p (sid)) {
*destination = sid;
return NUMBER_IDENTIFIER;
- } else if (unsmob_translator_def (sid)) {
- *destination = unsmob_translator_def (sid)->clone_scm();
+ } else if (unsmob_context_def (sid)) {
+ *destination = unsmob_context_def (sid)->clone_scm();
return TRANSLATOR_IDENTIFIER;
} else if (unsmob_score (sid)) {
Score *sc = new Score (*unsmob_score (sid));
error (_f ("can't find `%s'", "feta20.afm")
+ "\n" +_ ("Fonts have not been installed properly. Aborting"));
- unsmob_translator_def (definition_)->apply_default_property_operations (this);
+ unsmob_context_def (definition_)->apply_default_property_operations (this);
assert (dynamic_cast<Paper_def *> (output_def_));
assert (!daddy_trans_);
void
Score_performer::initialize ()
{
- unsmob_translator_def (definition_)->apply_default_property_operations (this);
+ unsmob_context_def (definition_)->apply_default_property_operations (this);
assert (dynamic_cast<Midi_def *> (output_def_));
performance_ = new Performance;
performance_->midi_ = dynamic_cast<Midi_def*> (output_def_);
/* if separate_contexts_b_ is set, create a new context with the
number number as name */
- SCM name = unsmob_translator_def (report_to ()->definition_)->get_context_name ();
+ SCM name = unsmob_context_def (report_to ()->definition_)->get_context_name ();
Translator_group * t = (j && separate_contexts_b_)
? report_to ()->find_create_translator (name, to_string (j), SCM_EOL)
: report_to ();
/*
- translator-def.cc -- implement Translator_def
+ translator-def.cc -- implement Context_def
source file of the GNU LilyPond music typesetter
#include "ly-smobs.icc"
int
-Translator_def::print_smob (SCM smob, SCM port, scm_print_state*)
+Context_def::print_smob (SCM smob, SCM port, scm_print_state*)
{
- Translator_def* me = (Translator_def*) SCM_CELL_WORD_1 (smob);
+ Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob);
- scm_puts ("#<Translator_def ", port);
+ scm_puts ("#<Context_def ", port);
scm_display (me->context_name_, port);
scm_puts (">", port);
return 1;
SCM
-Translator_def::mark_smob (SCM smob)
+Context_def::mark_smob (SCM smob)
{
- Translator_def* me = (Translator_def*) SCM_CELL_WORD_1 (smob);
+ Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob);
scm_gc_mark (me->description_);
scm_gc_mark (me->context_aliases_);
}
-Translator_def::Translator_def ()
+Context_def::Context_def ()
{
context_aliases_ = SCM_EOL;
translator_group_type_ = SCM_EOL;
smobify_self();
}
-Translator_def::~Translator_def ()
+Context_def::~Context_def ()
{
}
-Translator_def::Translator_def (Translator_def const & s)
+Context_def::Context_def (Context_def const & s)
: Input (s)
{
context_aliases_ = SCM_EOL;
void
-Translator_def::add_context_mod (SCM mod)
+Context_def::add_context_mod (SCM mod)
{
SCM tag = gh_car (mod);
if (ly_symbol2scm ("description") == tag)
SCM
-Translator_def::get_context_name () const
+Context_def::get_context_name () const
{
return context_name_;
}
SCM
-Translator_def::get_accepted () const
+Context_def::get_accepted () const
{
SCM correct_order = scm_reverse (accept_mods_);
SCM acc = SCM_EOL;
}
-Link_array<Translator_def>
-Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const
+Link_array<Context_def>
+Context_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const
{
assert (gh_symbol_p (type_sym));
SCM accepted = get_accepted ();
- Link_array<Translator_def> accepteds;
+ Link_array<Context_def> accepteds;
for (SCM s = accepted; gh_pair_p (s); s = ly_cdr (s))
{
- Translator_def *t = unsmob_translator_def (odef->find_translator (ly_car (s)));
+ Context_def *t = unsmob_context_def (odef->find_translator (ly_car (s)));
if (!t)
continue;
accepteds.push (t);
}
- Link_array<Translator_def> best_result;
+ Link_array<Context_def> best_result;
for (int i=0; i < accepteds.size (); i++)
{
/*
int best_depth= INT_MAX;
for (int i=0; i < accepteds.size (); i++)
{
- Translator_def * g = accepteds[i];
+ Context_def * g = accepteds[i];
- Link_array<Translator_def> result
+ Link_array<Context_def> result
= g->path_to_acceptable_translator (type_sym, odef);
if (result.size () && result.size () < best_depth)
{
return best_result;
}
-IMPLEMENT_SMOBS (Translator_def);
-IMPLEMENT_DEFAULT_EQUAL_P (Translator_def);
+IMPLEMENT_SMOBS (Context_def);
+IMPLEMENT_DEFAULT_EQUAL_P (Context_def);
SCM
-Translator_def::get_translator_names (SCM user_mod) const
+Context_def::get_translator_names (SCM user_mod) const
{
SCM l1 = SCM_EOL;
SCM l2 = SCM_EOL;
Translator_group *
-Translator_def::instantiate (Music_output_def* md, SCM ops)
+Context_def::instantiate (Music_output_def* md, SCM ops)
{
Translator * g = get_translator (translator_group_type_);
g = g->clone ();
tg->output_def_ = md;
tg->definition_ = self_scm ();
+ SCM trans_names = get_translator_names (ops);
+ tg->simple_trans_list_ = names_to_translators (trans_names);
+
return tg;
}
SCM
-Translator_def::clone_scm () const
+Context_def::clone_scm () const
{
- Translator_def * t = new Translator_def (*this);
+ Context_def * t = new Context_def (*this);
scm_gc_unprotect_object (t->self_scm());
return t->self_scm();
}
SCM
-Translator_def::make_scm ()
+Context_def::make_scm ()
{
- Translator_def* t = new Translator_def;
+ Context_def* t = new Context_def;
scm_gc_unprotect_object (t->self_scm());
return t->self_scm();
}
none.
*/
SCM
-Translator_def::default_child_context_name ()
+Context_def::default_child_context_name ()
{
SCM d = get_accepted ();
return gh_pair_p (d) ? ly_car (scm_last_pair (d)) : SCM_EOL;
}
void
-Translator_def::apply_default_property_operations (Translator_group *tg)
+Context_def::apply_default_property_operations (Translator_group *tg)
{
apply_property_operations (tg , property_ops_);
}
SCM
-Translator_def::to_alist () const
+Context_def::to_alist () const
{
SCM l = SCM_EOL;
}
bool
-Translator_def::is_alias (SCM sym) const
+Context_def::is_alias (SCM sym) const
{
bool b = sym == context_name_;
Translator_group::add_fresh_group_translator (Translator*t)
{
Translator_group*tg = dynamic_cast<Translator_group*> (t);
-
trans_group_list_ = add_translator (trans_group_list_,t);
-
- Translator_def * td = unsmob_translator_def (tg->definition_);
+ Context_def * td = unsmob_context_def (tg->definition_);
/*
this can not move before add_translator(), because \override
t->initialize ();
}
-
bool
Translator_group::is_removable () const
{
{
Translator * t = unsmob_translator (ly_car (p));
- r = dynamic_cast<Translator_group*> (t)->find_existing_translator (n, id);
- }
+ r = dynamic_cast<Translator_group*> (t)->find_existing_translator (n, id); }
return r;
}
if (existing)
return existing;
- Link_array<Translator_def> path
- = unsmob_translator_def (definition_)->path_to_acceptable_translator (n, get_output_def ());
+ Link_array<Context_def> path
+ = unsmob_context_def (definition_)->path_to_acceptable_translator (n, get_output_def ());
if (path.size ())
{
bool
Translator_group::is_bottom_translator_b () const
{
- return !gh_symbol_p (unsmob_translator_def (definition_)->default_child_context_name ());
+ return !gh_symbol_p (unsmob_context_def (definition_)->default_child_context_name ());
}
Translator_group*
{
if (!is_bottom_translator_b ())
{
- SCM nm = unsmob_translator_def (definition_)->default_child_context_name ();
+ SCM nm = unsmob_context_def (definition_)->default_child_context_name ();
SCM st = get_output_def ()->find_translator (nm);
- Translator_def *t = unsmob_translator_def (st);
+ Context_def *t = unsmob_context_def (st);
if (!t)
{
warning (_f ("can't find or create: `%s'", ly_symbol2string (nm).to_str0 ()));
- t = unsmob_translator_def (this->definition_);
+ t = unsmob_context_def (this->definition_);
}
Translator_group *tg = t->instantiate (output_def_, SCM_EOL);
add_fresh_group_translator (tg);
{
SCM tab = scm_make_vector (gh_int2scm (19), SCM_BOOL_F);
set_property ("acceptHashTable", tab);
- static_each (trans_group_list_, &Translator::initialize);
+ each (&Translator::initialize);
}
void
String
Translator_group::context_name () const
{
- Translator_def * td = unsmob_translator_def (definition_ );
+ Context_def * td = unsmob_context_def (definition_ );
return ly_symbol2string (td->get_context_name ());
}
SCM
Translator_group::get_simple_trans_list ()
{
+ return simple_trans_list_;
+
+#if 0
if (simple_trans_list_ != SCM_BOOL_F)
return simple_trans_list_;
- Translator_def * td = unsmob_translator_def (definition_);
+ Context_def * td = unsmob_context_def (definition_);
/*
The following cannot work, since start_translation_timestep ()
\property Voice.Voice =#'()
*/
+ trans_names = td->get_translator_names (SCM_EOL);
+
SCM trans_names = internal_get_property (td->get_context_name ());
if (!gh_pair_p (trans_names))
{
- trans_names = td->get_translator_names (SCM_EOL);
}
simple_trans_list_ = names_to_translators (trans_names, this);
static_each (simple_trans_list_, &Translator::initialize);
return simple_trans_list_;
+#endif
}
Translator *sc = (Translator *) ly_cdr (s);
scm_puts ("#<Translator ", port);
- if (Translator_def *d=unsmob_translator_def (sc->definition_))
+ if (Context_def *d=unsmob_context_def (sc->definition_))
{
scm_display (d->get_context_name (), port);
}
bool
Translator::is_alias (SCM sym) const
{
- return unsmob_translator_def (definition_)->is_alias (sym);
+ return unsmob_context_def (definition_)->is_alias (sym);
}
bool
is then separated.
- foo = \score { ... }
+ foo = \\score { ... }
#(as-xml foo)