]> git.donarmstrong.com Git - lilypond.git/commitdiff
remove ly_scm2str0.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 1 Sep 2004 18:41:20 +0000 (18:41 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 1 Sep 2004 18:41:20 +0000 (18:41 +0000)
ChangeLog
lily/include/lily-guile.hh
lily/lily-guile.cc
lily/lily-lexer.cc
lily/lily-parser.cc
lily/modified-font-metric.cc

index b0d708aed4c69305d4649eb102199913fba2c5ac..d941200f385c9f3bd096a259d75f3b8103d1493c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-09-01  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * lily/lily-guile.cc: remove ly_scm2str0.
+
 2004-09-01  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * Documentation/user/macros.itexi: Use @inforef iso @uref for
index 4374d028c410adeeb29d76045ea5cefc9db1e129..cd6ea97b87973de1d66cfbea8ef8ad9910d6024d 100644 (file)
@@ -146,7 +146,7 @@ inline bool ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
 inline bool ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); }
 inline bool ly_c_char_p (SCM x) { return SCM_CHARP (x); }
 inline bool ly_c_number_p (SCM x) { return SCM_NUMBERP (x); }
-inline bool ly_c_string_p (SCM x) { return SCM_STRINGP (x); }
+inline bool ly_c_string_p (SCM x) { return scm_is_string (x); }
 inline bool ly_c_vector_p (SCM x) { return SCM_VECTORP (x); }
 inline bool ly_c_list_p (SCM x) { return SCM_NFALSEP (scm_list_p (x)); }
 inline bool ly_c_procedure_p (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); }
index 9e759e7e9f93fccfb703bfc19e516c6552123e51..fb4903b7101331528a86d5e3ad5967919292cdc3 100644 (file)
@@ -73,8 +73,11 @@ ly_quote_scm (SCM s)
 String
 ly_symbol2string (SCM s)
 {
-  assert (ly_c_symbol_p (s));
-  return String ((Byte*)SCM_STRING_CHARS (s), (int) SCM_STRING_LENGTH (s));
+  /*
+    Ugh. this is not very efficient.
+   */
+  SCM str = scm_symbol_to_string (s);
+  return ly_scm2string (str);
 }
 
 String
@@ -122,18 +125,11 @@ ly_display_scm (SCM s)
 }
 };
 
-char const *
-ly_scm2str0 (SCM string)
-{
-  SCM_ASSERT_TYPE (ly_c_string_p (string), string, SCM_ARG1,
-                  __FUNCTION__, "string");
-  return SCM_STRING_CHARS (string);
-}
-
 String
-ly_scm2string (SCM string)
+ly_scm2string (SCM str)
 {
-  return ly_scm2str0 (string);
+  return String ((Byte*)scm_i_string_chars (str),
+                (int) scm_i_string_length (str));
 }
 
 char *
@@ -144,7 +140,7 @@ ly_scm2newstr (SCM str, size_t *lenp)
   size_t len = SCM_STRING_LENGTH (str);
   if (char *new_str = (char *) malloc ((len + 1) * sizeof (char)))
     {
-      memcpy (new_str, SCM_STRING_CHARS (str), len);
+      memcpy (new_str, scm_i_string_chars (str), len);
       new_str[len] = '\0';
 
       if (lenp)
@@ -824,5 +820,5 @@ LY_DEFINE (ly_gettext, "ly:gettext",
 {
   SCM_ASSERT_TYPE (ly_c_string_p (string), string, SCM_ARG1,
                   __FUNCTION__, "string");
-  return scm_makfrom0str (gettext (ly_scm2str0 (string)));
+  return scm_makfrom0str (gettext (scm_i_string_chars (string)));
 }
index 2f926ea67431e3519dfc951059e21a3c19d2cb53..9226c5440a8679bb01691402726fe4ebe0dd682e 100644 (file)
@@ -216,7 +216,8 @@ Lily_lexer::set_identifier (SCM name, SCM s)
     {
       if (lookup_keyword (ly_symbol2string (sym)) >= 0)
        {
-         warning (_f ("Identifier name is a keyword: `%s'", SCM_SYMBOL_CHARS (sym)));
+         String symstr = ly_symbol2string (sym); 
+         warning (_f ("Identifier name is a keyword: `%s'", symstr.to_str0()));
        }
 
       SCM mod = ly_car (scopes_);
index c489c356f2982e5220af812f60767fcce6d04601..818ae67289024cdc6c1e5c40ef7894dd3dca3cb6 100644 (file)
@@ -257,7 +257,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file",
           "Upon failure, throw @code{ly-file-failed} key.")
 {
   SCM_ASSERT_TYPE (ly_c_string_p (name), name, SCM_ARG1, __FUNCTION__, "string");
-  char const *file = SCM_STRING_CHARS (name);
+  char const *file = scm_i_string_chars (name);
   char const *extensions[] = {"ly", "", 0};
 
   String file_name = global_path.find (file, extensions);
index 875c87ef0cfb756d03e5912ece5da6ff3d5b25c1..2b67671b2da2657a72e298c0573e3e39231cf147 100644 (file)
@@ -280,7 +280,7 @@ Modified_font_metric::text_dimension (String text)
          if (!ly_c_symbol_p (sym))
            continue;
 
-         char const * chars =  SCM_SYMBOL_CHARS(sym);
+         char const * chars =  scm_i_string_chars (scm_symbol_to_string(sym));
          
          int idx = orig_->name_to_index (chars);
          if (idx >= 0)