+ SCM definition = scm_car (s);
+ bool is_scheme = false;
+
+ Translator *type = 0;
+ if (ly_is_symbol (definition))
+ type = get_translator (definition);
+ else if (ly_is_pair (definition))
+ {
+ type = get_translator (ly_symbol2scm ("Scheme_engraver"));
+ is_scheme = true;
+ }
+ else if (ly_is_procedure (definition))
+ {
+ // `definition' is a procedure, which takes the context as
+ // an argument and evaluates to an a-list scheme engraver
+ // definition.
+ definition = scm_call_1 (definition, cs);
+ type = get_translator (ly_symbol2scm ("Scheme_engraver"));
+ is_scheme = true;
+ }
+
+ if (!type)
+ warning (_f ("cannot find: `%s'", ly_symbol2string (scm_car (s)).c_str ()));
+ else
+ {
+ Translator *instance = type->clone ();
+ if (is_scheme)
+ dynamic_cast<Scheme_engraver *> (instance)->init_from_scheme (definition);
+
+ SCM str = instance->self_scm ();
+
+ if (instance->must_be_last ())
+ {
+ SCM cons = scm_cons (str, SCM_EOL);
+ if (scm_is_pair (trans_list))
+ scm_set_cdr_x (scm_last_pair (trans_list), cons);
+ else
+ trans_list = cons;
+ }
+ else
+ trans_list = scm_cons (str, trans_list);
+
+ instance->daddy_context_ = new_context;
+ instance->unprotect ();
+ }