+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
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)); }
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
}
};
-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 *
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)
{
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)));
}
{
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_);
"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);
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)