]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lily-guile.cc
* po/nl.po: Some updates.
[lilypond.git] / lily / lily-guile.cc
index 07d3266d9c62d90b9b50854f46cc42af9b776f83..812f344a70855ab458f12d83f0bcac09fffc66cf 100644 (file)
@@ -121,14 +121,18 @@ ly_display_scm (SCM s)
 }
 };
 
-String
-ly_scm2string (SCM s)
+char const *
+ly_scm2str0 (SCM string)
 {
-  assert (ly_c_string_p (s));
+  SCM_ASSERT_TYPE (ly_c_string_p (string), string, SCM_ARG1,
+                  __FUNCTION__, "string");
+  return SCM_STRING_CHARS (string);
+}
 
-  char *p = SCM_STRING_CHARS (s);
-  String r (p);
-  return r;
+String
+ly_scm2string (SCM string)
+{
+  return ly_scm2str0 (string);
 }
 
 char *
@@ -181,6 +185,19 @@ LY_DEFINE (ly_warn, "ly:warn",
   return SCM_UNSPECIFIED;
 }
 
+LY_DEFINE (ly_programming_error, "ly:programming-error",
+          1, 0, 1, (SCM str, SCM rest),
+          "Scheme callable function to issue the warning @code{msg}. "
+          "The message is formatted with @code{format} and @code{rest}.")
+{
+  SCM_ASSERT_TYPE (ly_c_string_p (str), str, SCM_ARG1, __FUNCTION__, "string");
+  progress_indication ("\n");
+
+  str = scm_simple_format (SCM_BOOL_F, str, rest);
+  programming_error (ly_scm2string (str));
+  return SCM_UNSPECIFIED;
+}
+
 LY_DEFINE (ly_dir_p, "ly:dir?",
           1, 0, 0, (SCM s),
          "type predicate. A direction is @code{-1}, @code{0} or "
@@ -265,7 +282,7 @@ is_axis (SCM s)
 Direction
 to_dir (SCM s)
 {
-  return SCM_INUMP (s) ? (Direction) ly_scm2int (s) : CENTER;
+  return scm_is_integer (s) ? (Direction) ly_scm2int (s) : CENTER;
 }
 
 Interval
@@ -760,9 +777,9 @@ alist_to_hashq (SCM alist)
 {
   int i = scm_ilength (alist);
   if (i < 0)
-    return scm_make_vector (scm_int2num (0), SCM_EOL);
+    return scm_c_make_hash_table (0);
          
-  SCM tab = scm_make_vector (scm_int2num (i), SCM_EOL);
+  SCM tab = scm_c_make_hash_table (i);
   for (SCM s = alist; ly_c_pair_p (s); s = ly_cdr (s))
     {
       SCM pt = ly_cdar (s);
@@ -798,3 +815,12 @@ LY_DEFINE (ly_pango_add_afm_decoder, "ly:pango-add-afm-decoder",
 }
 
 #endif
+
+LY_DEFINE (ly_gettext, "ly:gettext",
+          1, 0, 0, (SCM string),
+          "Gettext wrapper.")
+{
+  SCM_ASSERT_TYPE (ly_c_string_p (string), string, SCM_ARG1,
+                  __FUNCTION__, "string");
+  return scm_makfrom0str (gettext (ly_scm2str0 (string)));
+}