- // TODO: The above operations should be performed by a listener to the following event.
- send_stream_event (this, "CreateContext",
- ly_symbol2scm ("unique"), scm_int2num (unique),
+ send_stream_event (this, "AnnounceNewContext", 0,
+ ly_symbol2scm ("context"), new_context->self_scm (),
+ ly_symbol2scm ("creator"), sev);
+}
+
+vector<Context_def *>
+Context::path_to_acceptable_context (SCM name) const
+{
+ // The 'accepts elements in definition_mods_ is a list of ('accepts string),
+ // but the Context_def expects to see elements of the form ('accepts symbol).
+ SCM accepts = SCM_EOL;
+ for (SCM s = scm_reverse (definition_mods_); scm_is_pair (s); s = scm_cdr (s))
+ if (scm_caar (s) == ly_symbol2scm ("accepts"))
+ {
+ SCM elt = scm_list_2 (scm_caar (s), scm_string_to_symbol (scm_cadar (s)));
+ accepts = scm_cons (elt, accepts);
+ }
+
+ return unsmob_context_def (definition_)->path_to_acceptable_context (name,
+ get_output_def (),
+ accepts);
+
+}
+
+Context *
+Context::create_context (Context_def *cdef,
+ string id,
+ SCM ops)
+{
+ infant_event_ = 0;
+ /* TODO: This is fairly misplaced. We can fix this when we have taken out all
+ iterator specific stuff from the Context class */
+ event_source_->
+ add_listener (GET_LISTENER (acknowledge_infant),
+ ly_symbol2scm ("AnnounceNewContext"));
+ /* The CreateContext creates a new context, and sends an announcement of the
+ new context through another event. That event will be stored in
+ infant_event_ to create a return value. */
+ send_stream_event (this, "CreateContext", 0,