+/* TODO: this shares code with find_create_context (). */
+Context *
+Context::create_unique_context (SCM n, SCM operations)
+{
+ /*
+ Don't create multiple score contexts.
+ */
+ if (dynamic_cast<Global_context *> (this)
+ && dynamic_cast<Global_context *> (this)->get_score_context ())
+ return get_score_context ()->create_unique_context (n, operations);
+
+ /*
+ TODO: use accepts_list_.
+ */
+ Link_array<Context_def> path
+ = unsmob_context_def (definition_)->path_to_acceptable_context (n, get_output_def ());
+
+ if (path.size ())
+ {
+ Context *current = this;
+
+ // start at 1. The first one (index 0) will be us.
+ for (int i = 0; i < path.size (); i++)
+ {
+ SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
+
+ current = current->create_context (path[i],
+ "\\new",
+ ops);
+ }
+
+ return current;
+ }