if (!SCM_UNBNDP (text))
{
- if (!SCM_STRINGP (text))
+ if (!scm_is_string (text))
{
--in_readline;
scm_wrong_type_arg (s_scm_readline, SCM_ARG1, text);
{
SCM ret;
char *s;
- char *prompt = SCM_UNBNDP (text) ? "" : SCM_STRING_CHARS (text);
+ char *prompt = SCM_UNBNDP (text) ? "" : scm_to_locale_string (text);
promptp = 1;
s = readline (prompt);
if (s)
- ret = scm_makfrom0str (s);
+ ret = scm_from_locale_string (s);
else
ret = SCM_EOF_VAL;
+ if (!SCM_UNBNDP (text))
+ free (prompt);
free (s);
return ret;
#define FUNC_NAME s_scm_add_history
{
char* s;
- SCM_VALIDATE_STRING (1,text);
- s = SCM_STRING_CHARS (text);
- add_history (strdup (s));
+ s = scm_to_locale_string (text);
+ add_history (s);
return SCM_UNSPECIFIED;
}
"")
#define FUNC_NAME s_scm_read_history
{
- SCM_VALIDATE_STRING (1,file);
- return scm_from_bool (!read_history (SCM_STRING_CHARS (file)));
+ char *filename;
+ SCM ret;
+
+ filename = scm_to_locale_string (file);
+ ret = scm_from_bool (!read_history (filename));
+ free (filename);
+ return ret;
}
#undef FUNC_NAME
"")
#define FUNC_NAME s_scm_write_history
{
- SCM_VALIDATE_STRING (1,file);
- return scm_from_bool (!write_history (SCM_STRING_CHARS (file)));
+ char *filename;
+ SCM ret;
+
+ filename = scm_to_locale_string (file);
+ ret = scm_from_bool (!write_history (filename));
+ free (filename);
+ return ret;
}
#undef FUNC_NAME
{
char *s;
SCM ans;
- SCM_VALIDATE_STRING (1,text);
+ char *c_text = scm_to_locale_string (text);
#ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
- s = rl_filename_completion_function (SCM_STRING_CHARS (text), scm_is_true (continuep));
+ s = rl_filename_completion_function (c_text, scm_is_true (continuep));
#else
- s = filename_completion_function (SCM_STRING_CHARS (text), scm_is_true (continuep));
+ s = filename_completion_function (c_text, scm_is_true (continuep));
#endif
- ans = scm_makfrom0str (s);
- free (s);
+ ans = scm_take_locale_string (s);
+ free (c_text);
return ans;
}
#undef FUNC_NAME
return NULL; /* #f => completion disabled */
else
{
- SCM t = scm_makfrom0str (text);
+ SCM t = scm_from_locale_string (text);
SCM c = scm_from_bool (continuep);
res = scm_apply (compfunc, scm_list_2 (t, c), SCM_EOL);
if (scm_is_false (res))
return NULL;
- if (!SCM_STRINGP (res))
- scm_misc_error (s_scm_readline,
- "Completion function returned bogus value: %S",
- scm_list_1 (res));
- return strdup (SCM_STRING_CHARS (res));
+ return scm_to_locale_string (res);
}
}
static SCM
out_of_range_handler (void *data, SCM key, SCM args)
{
- return scm_equal_p (key, scm_str2symbol ("out-of-range"));
+ return scm_equal_p (key, scm_from_locale_symbol ("out-of-range"));
}
static SCM
wrong_type_handler (void *data, SCM key, SCM args)
{
- return scm_equal_p (key, scm_str2symbol ("wrong-type-arg"));
+ return scm_equal_p (key, scm_from_locale_symbol ("wrong-type-arg"));
}
static SCM
misc_error_handler (void *data, SCM key, SCM args)
{
- return scm_equal_p (key, scm_str2symbol ("misc-error"));
+ return scm_equal_p (key, scm_from_locale_symbol ("misc-error"));
}
static SCM
int len = strlen (lit);
int result;
- result = ((SCM_STRING_LENGTH (str) == len)
- && (!memcmp (SCM_STRING_CHARS (str), lit, len)));
+ result = ((scm_i_string_length (str) == len)
+ && (!memcmp (scm_i_string_chars (str), lit, len)));
scm_remember_upto_here_1 (str);
return result;
}
code if you have to copy the string just to look at it. */
/* Copy a substring to an overlapping region to its right. */
- gh_set_substr (SCM_STRING_CHARS (string), string, 4, 6);
+ gh_set_substr (scm_i_string_chars (string), string, 4, 6);
assert (string_equal (string, "FreeFree, it!"));
string = gh_str02scm ("Free, darnit!");
assert (gh_string_p (string));
/* Copy a substring to an overlapping region to its left. */
- gh_set_substr (SCM_STRING_CHARS (string) + 6, string, 2, 6);
+ gh_set_substr (scm_i_string_chars (string) + 6, string, 2, 6);
assert (string_equal (string, "Frdarnitrnit!"));
}
scm_frame_begin (0);
{
- SCM port = scm_open_file (scm_str2string (filename),
- scm_str2string ("w"));
+ SCM port = scm_open_file (scm_from_locale_string (filename),
+ scm_from_locale_string ("w"));
scm_frame_unwind_handler_with_scm (close_port, port,
SCM_F_WIND_EXPLICITLY);
scm_frame_begin (0);
{
- SCM port = scm_open_file (scm_str2string (filename),
- scm_str2string ("r"));
+ SCM port = scm_open_file (scm_from_locale_string (filename),
+ scm_from_locale_string ("r"));
SCM res;
scm_frame_unwind_handler_with_scm (close_port, port,
SCM_F_WIND_EXPLICITLY);