+
+
+void
+taint (SCM *)
+{
+ /*
+ nop.
+ */
+}
+
+/*
+ display stuff without using stack
+ */
+SCM
+display_list (SCM s)
+{
+ SCM p = scm_current_output_port ();
+
+ scm_puts ("(", p);
+ for (; scm_is_pair (s); s =scm_cdr (s))
+ {
+ scm_display (scm_car (s), p);
+ scm_puts (" ", p);
+ }
+ scm_puts (")", p);
+ return SCM_UNSPECIFIED;
+}
+
+Slice
+int_list_to_slice (SCM l)
+{
+ Slice s;
+ s.set_empty ();
+ for (; scm_is_pair (l); l = scm_cdr (l))
+ if (scm_is_number (scm_car (l)))
+ s.add_point (scm_to_int (scm_car (l)));
+ return s;
+}
+
+/* Return I-th element, or last elt L. If I < 0, then we take the first
+ element.
+
+ PRE: length (L) > 0 */
+SCM
+robust_list_ref (int i, SCM l)
+{
+ while (i-- > 0 && scm_is_pair (scm_cdr (l)))
+ l = scm_cdr (l);
+ return scm_car (l);
+}
+
+Real
+robust_scm2double (SCM k, double x)
+{
+ if (scm_is_number (k))
+ x = scm_to_double (k);
+ return x;
+}
+
+Interval
+robust_scm2interval (SCM k, Drul_array<Real> v)
+{
+ Interval i;
+ i[LEFT]= v[LEFT];
+ i[RIGHT]= v[RIGHT];
+ if (is_number_pair (k))
+ i = ly_scm2interval (k);
+ return i;
+}
+
+Drul_array<Real>
+robust_scm2drul (SCM k, Drul_array<Real> v)
+{
+ if (is_number_pair (k))
+ v = ly_scm2interval (k);
+ return v;
+}
+
+Offset
+robust_scm2offset (SCM k, Offset o)
+{
+ if (is_number_pair (k))
+ o = ly_scm2offset (k);
+ return o;
+}
+
+int
+robust_scm2int (SCM k, int o)
+{
+ if (scm_integer_p (k) == SCM_BOOL_T)
+ o = scm_to_int (k);
+ return o;
+}
+
+SCM
+alist_to_hashq (SCM alist)
+{
+ int i = scm_ilength (alist);
+ if (i < 0)
+ return scm_c_make_hash_table (0);
+
+ SCM tab = scm_c_make_hash_table (i);
+ for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
+ {
+ SCM pt = scm_cdar (s);
+ scm_hashq_set_x (tab, scm_caar (s), pt);
+ }
+ return tab;
+}
+
+#if 1
+/*
+ Debugging mem leaks:
+ */
+LY_DEFINE (ly_protects, "ly:protects",
+ 0, 0, 0, (),
+ "Return hash of protected objects.")
+{
+ return scm_protects;
+}
+#endif
+
+
+#if HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC
+
+#include "pangofc-afm-decoder.hh"
+
+LY_DEFINE (ly_pango_add_afm_decoder, "ly:pango-add-afm-decoder",
+ 1, 0, 0, (SCM font_family),
+ "Add pango afm decoder for FONT-FAMILY.")
+{
+ SCM_ASSERT_TYPE (scm_is_string (font_family), font_family, SCM_ARG1,
+ __FUNCTION__, "font_family");
+ pango_fc_afm_add_decoder (ly_scm2newstr (font_family, 0));
+ return SCM_UNSPECIFIED;
+}
+
+#endif
+
+LY_DEFINE (ly_gettext, "ly:gettext",
+ 1, 0, 0, (SCM string),
+ "Gettext wrapper.")
+{
+ SCM_ASSERT_TYPE (scm_is_string (string), string, SCM_ARG1,
+ __FUNCTION__, "string");
+ return scm_makfrom0str (gettext (scm_i_string_chars (string)));
+}
+