X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fcontext-def.cc;h=a810159aa326d601cb75f950f9f7e4e3c0e0a3a3;hb=a01b3c6afd1d3f1471f5f6429f6bd056895da750;hp=c3a2a6c293b88594989b633393bb7f340103f629;hpb=3d0c45c00d400d3430fc4c0beb41cf96ebd28889;p=lilypond.git diff --git a/lily/context-def.cc b/lily/context-def.cc index c3a2a6c293..a810159aa3 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 2000--2006 Han-Wen Nienhuys + (c) 2000--2007 Han-Wen Nienhuys */ /* TODO: should junk this class an replace by @@ -87,7 +87,7 @@ Context_def::print_smob (SCM smob, SCM port, scm_print_state*) SCM Context_def::mark_smob (SCM smob) { - ASSERT_LIVE_IS_ALLOWED(); + ASSERT_LIVE_IS_ALLOWED (); Context_def *me = (Context_def *) SCM_CELL_WORD_1 (smob); @@ -193,12 +193,24 @@ Context_def::get_default_child (SCM user_mod) const return name; } +/* + Given a name of a context that we want to create, finds a list of context + definitions such that: + - the first element in the list defines a context that is a valid child of + the context defined by this Context_def + - each subsequent element in the list defines a context that is a valid child + of the the context defined by the preceding element in the list + - the last element in the list defines a context with the given name + + The ADDITIONAL_ACCEPTS parameter is a list of additional contexts that this + specific context def (but not any of the child context defs) should accept. +*/ vector -Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const +Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef, SCM additional_accepts) const { assert (scm_is_symbol (type_sym)); - SCM accepted = get_accepted (SCM_EOL); + SCM accepted = get_accepted (additional_accepts); vector accepteds; for (SCM s = accepted; scm_is_pair (s); s = scm_cdr (s)) @@ -224,7 +236,7 @@ Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const Context_def *g = accepteds[i]; vector result - = g->path_to_acceptable_context (type_sym, odef); + = g->path_to_acceptable_context (type_sym, odef, SCM_EOL); if (result.size () && result.size () < best_depth) { best_depth = result.size (); @@ -261,9 +273,9 @@ Context_def::get_translator_names (SCM user_mod) const } Context * -Context_def::instantiate (SCM ops, Object_key const *key) +Context_def::instantiate (SCM ops) { - Context *context = new Context (key); + Context *context = new Context (); context->definition_ = self_scm (); context->definition_mods_ = ops;