@unnumberedsubsubsec Bottom-level contexts - voices
Voice-level contexts initialise certain properties and start
-appropriate engravers. Being bottom-level contexts, they cannot
-contain other contexts.
+appropriate engravers. A bottom-level context is one without
+@code{defaultchild}. While it is possible to let it
+accept/@/contain subcontexts, they can only be created and entered
+explicitly.
@strong{@emph{Voice}}
context->definition_mods_ = ops;
context->aliases_ = context_aliases_;
context->accepts_list_ = get_accepted (ops);
+ context->default_child_ = get_default_child (ops);
return context;
}
get_translator_names (SCM_EOL)), ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("description"), description_), ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("aliases"), context_aliases_), ell);
+ ell = scm_cons (scm_cons (ly_symbol2scm ("accepts"), get_accepted (SCM_EOL)),
+ ell);
+ if (scm_is_symbol (default_child_))
+ ell = scm_acons (ly_symbol2scm ("default-child"), default_child_, ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("accepts"), get_accepted (SCM_EOL)),
ell);
ell = scm_cons (scm_cons (ly_symbol2scm ("property-ops"), property_ops_),
Context_def::is_alias (SCM sym) const
{
if (scm_is_eq (sym, ly_symbol2scm ("Bottom")))
- return !scm_is_pair (get_accepted (SCM_EOL));
+ return !scm_is_symbol (get_default_child (SCM_EOL));
if (scm_is_eq (sym, get_context_name ()))
return true;
implementation_ = 0;
properties_scm_ = SCM_EOL;
accepts_list_ = SCM_EOL;
+ default_child_ = SCM_EOL;
context_list_ = SCM_EOL;
definition_ = SCM_EOL;
definition_mods_ = SCM_EOL;
SCM
Context::default_child_context_name () const
{
- return scm_is_pair (accepts_list_)
- ? scm_car (accepts_list_)
- : SCM_EOL;
+ return default_child_;
}
bool
bool
Context::is_alias (SCM sym) const
{
- if (sym == ly_symbol2scm ("Bottom")
- && !scm_is_pair (accepts_list_))
- return true;
- if (sym == unsmob_context_def (definition_)->get_context_name ())
+ if (scm_is_eq (sym, ly_symbol2scm ("Bottom")))
+ return is_bottom_context ();
+ if (scm_is_eq (sym, context_name_symbol ()))
return true;
return scm_c_memq (sym, aliases_) != SCM_BOOL_F;
scm_gc_mark (me->definition_mods_);
scm_gc_mark (me->properties_scm_);
scm_gc_mark (me->accepts_list_);
+ scm_gc_mark (me->default_child_);
if (me->implementation_)
scm_gc_mark (me->implementation_->self_scm ());
for (; scm_is_pair (p); p = scm_cdr (p))
scm_hashq_set_x (ancestor_lookup_, scm_caar (p), scm_car (p));
- accepts_list_ = scm_list_1 (ly_symbol2scm ("Score"));
+ default_child_ = ly_symbol2scm ("Score");
+ accepts_list_ = scm_list_1 (default_child_);
}
Output_def *
SCM properties_scm_;
SCM context_list_;
SCM accepts_list_;
+ SCM default_child_;
SCM aliases_;
Translator_group *implementation_;
string id_string_;
\context {
\name Global
\accepts Score
+ \defaultchild Score
\description "Hard coded entry point for LilyPond. Cannot be tuned."
EventClasses = #all-event-classes
}
\type "Performer_group"
\consists "Staff_performer"
\accepts ChordNameVoice
+ \defaultchild ChordNameVoice
\name ChordNames
}