+
+SCM
+ly_hash2alist (SCM tab)
+{
+ SCM func = ly_lily_module_constant ("hash-table->alist");
+ return scm_call_1 (func, tab);
+}
+
+int
+procedure_arity (SCM proc)
+{
+ assert (ly_is_procedure (proc));
+ SCM arity = scm_procedure_property (proc,
+ ly_symbol2scm ("arity"));
+
+ SCM fixed = scm_car (arity);
+ return scm_to_int (fixed);
+}
+
+/*
+ C++ interfacing.
+ */
+
+string
+mangle_cxx_identifier (string cxx_id)
+{
+ if (cxx_id.substr (0, 3) == "ly_")
+ cxx_id = cxx_id.replace (0, 3, "ly:");
+ else
+ {
+ cxx_id = String_convert::to_lower (cxx_id);
+ cxx_id = "ly:" + cxx_id;
+ }
+ if (cxx_id.substr (cxx_id.length () - 2) == "_p")
+ cxx_id = cxx_id.replace (cxx_id.length () - 2, 1, "?");
+ else if (cxx_id.substr (cxx_id.length () - 2) == "_x")
+ cxx_id = cxx_id.replace (cxx_id.length () - 2, 1, "!");
+
+ cxx_id = replace_all (cxx_id, '_', '-');
+ return cxx_id;
+}
+
+
+
+SCM
+ly_string_array_to_scm (vector<string> a)
+{
+ SCM s = SCM_EOL;
+ for (vsize i = a.size (); i ; i--)
+ s = scm_cons (ly_symbol2scm (a[i - 1].c_str ()), s);
+ return s;
+}
+
+/* SYMBOLS is a whitespace separated list. */
+SCM
+parse_symbol_list (char const *symbols)
+{
+ while (isspace (*symbols))
+ *symbols++;
+ string s = symbols;
+ replace_all (s, '\n', ' ');
+ replace_all (s, '\t', ' ');
+ return ly_string_array_to_scm (string_split (s, ' '));
+}
+
+
+bool
+ly_is_fraction (SCM x)
+{
+ return SCM_FRACTIONP(x);
+}
+
+struct ly_t_double_cell
+{
+ SCM a;
+ SCM b;
+ SCM c;
+ SCM d;
+};