summaryrefslogtreecommitdiff
path: root/libguile/filesys.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2004-08-19 17:19:44 +0000
committerMarius Vollmer <mvo@zagadka.de>2004-08-19 17:19:44 +0000
commitcc95e00ac63820cbc03ca858ff6b8e1015c9d168 (patch)
tree31ed97062f17f16438e0674bd963454f22fa6754 /libguile/filesys.c
parentf76c6bb2342534158769cc55ce40edd17492f9c4 (diff)
downloadguile-cc95e00ac63820cbc03ca858ff6b8e1015c9d168.tar.gz
* strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,
scm_i_string_writable_chars, scm_i_string_stop_writing): New, to replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH. Updated all uses. (scm_i_make_string, scm_c_make_string): New, to replace scm_allocate_string. Updated all uses. (SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS, SCM_STRING_LENGTH): Deprecated. (scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string, scm_str2string, scm_makfrom0str, scm_makfrom0str_opt): Discouraged. Replaced all uses with scm_from_locale_string or similar, as appropriate. (scm_c_string_length, scm_c_string_ref, scm_c_string_set_x, scm_c_substring, scm_c_substring_shared, scm_c_substring_copy, scm_substring_shared, scm_substring_copy): New. * symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC, SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS, SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol, scm_str2symbol, scm_mem2uninterned_symbol): Discouraged. (SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str): Deprecated. (SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS, SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed. (scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln): New, to replace scm_str2symbol and scm_mem2symbol, respectively. Updated all uses. (scm_gensym): Generate only the number suffix in the buffer, just string-append the prefix.
Diffstat (limited to 'libguile/filesys.c')
-rw-r--r--libguile/filesys.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/libguile/filesys.c b/libguile/filesys.c
index 403996d04..af3ddc514 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -863,7 +863,7 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0,
if (errno != 0)
SCM_SYSERROR;
- return (rdent ? scm_mem2string (rdent->d_name, NAMLEN (rdent))
+ return (rdent ? scm_from_locale_stringn (rdent->d_name, NAMLEN (rdent))
: SCM_EOF_VAL);
}
}
@@ -977,7 +977,7 @@ SCM_DEFINE (scm_getcwd, "getcwd", 0, 0, 0,
errno = save_errno;
SCM_SYSERROR;
}
- result = scm_mem2string (wd, strlen (wd));
+ result = scm_from_locale_stringn (wd, strlen (wd));
free (wd);
return result;
}
@@ -1501,14 +1501,14 @@ SCM_DEFINE (scm_dirname, "dirname", 1, 0, 0,
"component, @code{.} is returned.")
#define FUNC_NAME s_scm_dirname
{
- char *s;
+ const char *s;
long int i;
unsigned long int len;
SCM_VALIDATE_STRING (1, filename);
- s = SCM_I_STRING_CHARS (filename);
- len = SCM_I_STRING_LENGTH (filename);
+ s = scm_i_string_chars (filename);
+ len = scm_i_string_length (filename);
i = len - 1;
#ifdef __MINGW32__
@@ -1527,12 +1527,12 @@ SCM_DEFINE (scm_dirname, "dirname", 1, 0, 0,
#else
if (len > 0 && s[0] == '/')
#endif /* ndef __MINGW32__ */
- return scm_substring (filename, SCM_INUM0, scm_from_int (1));
+ return scm_c_substring (filename, 0, 1);
else
return scm_dot_string;
}
else
- return scm_substring (filename, SCM_INUM0, scm_from_int (i + 1));
+ return scm_c_substring (filename, 0, i + 1);
}
#undef FUNC_NAME
@@ -1544,20 +1544,20 @@ SCM_DEFINE (scm_basename, "basename", 1, 1, 0,
"@var{basename}, it is removed also.")
#define FUNC_NAME s_scm_basename
{
- char *f, *s = 0;
+ const char *f, *s = 0;
int i, j, len, end;
SCM_VALIDATE_STRING (1, filename);
- f = SCM_I_STRING_CHARS (filename);
- len = SCM_I_STRING_LENGTH (filename);
+ f = scm_i_string_chars (filename);
+ len = scm_i_string_length (filename);
if (SCM_UNBNDP (suffix))
j = -1;
else
{
SCM_VALIDATE_STRING (2, suffix);
- s = SCM_I_STRING_CHARS (suffix);
- j = SCM_I_STRING_LENGTH (suffix) - 1;
+ s = scm_i_string_chars (suffix);
+ j = scm_i_string_length (suffix) - 1;
}
i = len - 1;
#ifdef __MINGW32__
@@ -1581,12 +1581,12 @@ SCM_DEFINE (scm_basename, "basename", 1, 1, 0,
#else
if (len > 0 && f[0] == '/')
#endif /* ndef __MINGW32__ */
- return scm_substring (filename, SCM_INUM0, scm_from_int (1));
+ return scm_c_substring (filename, 0, 1);
else
return scm_dot_string;
}
else
- return scm_substring (filename, scm_from_int (i+1), scm_from_int (end+1));
+ return scm_c_substring (filename, i+1, end+1);
}
#undef FUNC_NAME
@@ -1601,7 +1601,7 @@ scm_init_filesys ()
scm_set_smob_free (scm_tc16_dir, scm_dir_free);
scm_set_smob_print (scm_tc16_dir, scm_dir_print);
- scm_dot_string = scm_permanent_object (scm_makfrom0str ("."));
+ scm_dot_string = scm_permanent_object (scm_from_locale_string ("."));
#ifdef O_RDONLY
scm_c_define ("O_RDONLY", scm_from_long (O_RDONLY));