summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--RELEASE3
-rw-r--r--libguile/ChangeLog22
-rw-r--r--libguile/dynl.c2
-rw-r--r--libguile/filesys.c6
-rw-r--r--libguile/gh_data.c4
-rw-r--r--libguile/hash.c3
-rw-r--r--libguile/load.c10
-rw-r--r--libguile/numbers.c2
-rw-r--r--libguile/ports.c2
-rw-r--r--libguile/posix.c6
-rw-r--r--libguile/print.c11
-rw-r--r--libguile/random.c2
-rw-r--r--libguile/socket.c6
-rw-r--r--libguile/strings.c6
-rw-r--r--libguile/strings.h2
-rw-r--r--libguile/strop.c8
-rw-r--r--libguile/strorder.c16
-rw-r--r--libguile/strports.c2
-rw-r--r--libguile/struct.c2
-rw-r--r--libguile/symbols.c8
-rw-r--r--libguile/symbols.h21
22 files changed, 86 insertions, 63 deletions
diff --git a/NEWS b/NEWS
index 0e7a4976b..99e6d6694 100644
--- a/NEWS
+++ b/NEWS
@@ -263,7 +263,8 @@ SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
-SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING
+SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
+SCM_ROUCHARS
Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
Use scm_memory_error instead of SCM_NALLOC.
@@ -277,6 +278,8 @@ Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
Use SCM_STRINGP instead of SCM_RWSTRINGP.
Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
+Use SCM_STRING_CHARS instead of SCM_ROCHARS.
+Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
** Removed function: scm_struct_init
diff --git a/RELEASE b/RELEASE
index 8ba49614f..98520bb76 100644
--- a/RELEASE
+++ b/RELEASE
@@ -49,7 +49,8 @@ In release 1.6:
SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS, SCM_VALIDATE_ROSTRING,
SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH,
SCM_LENGTH, SCM_HUGE_LENGTH, SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
- SCM_COERCE_SUBSTR, SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING
+ SCM_COERCE_SUBSTR, SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING,
+ SCM_ROCHARS, SCM_ROUCHARS
- remove scm_vector_set_length_x
- remove function scm_call_catching_errors
(replaced by catch functions from throw.[ch])
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 75f282ae5..9934bd78a 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,25 @@
+2000-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * dynl.c (scm_make_argv_from_stringlist), filesys.c (scm_dirname,
+ scm_basename), gh_data.c (gh_scm2newstr, gh_get_substr), hash.c
+ (scm_hasher), load.c (scm_parse_path, scm_search_path,
+ scm_primitive_load_path), numbers.c (scm_string_to_number),
+ ports.c (scm_unread_string), posix.c (scm_convert_exec_args,
+ environ_list_to_c, scm_putenv), print.c (scm_iprin1,
+ scm_simple_format), random.c (scm_seed_to_random_state), socket.c
+ (scm_fill_sockaddr, scm_send, scm_sendto), strings.c
+ (scm_string_ref, scm_substring, scm_string_append), strings.h
+ (SCM_STRING_COERCE_0TERMINATION_X), strop.c (scm_i_index,
+ scm_string_to_list, scm_string_copy), strorder.c
+ (scm_string_equal_p, scm_string_ci_equal_p, scm_string_less_p,
+ scm_string_ci_less_p), strports.c (scm_mkstrport), struct.c
+ (scm_make_struct_layout), symbols.c (scm_string_to_symbol,
+ scm_string_to_obarray_symbol, scm_gensym, scm_gentemp): Replace
+ calls to SCM_ROU?CHARS with the corresponding call to
+ SCM_STRING_U?CHARS.
+
+ * symbols.h (SCM_ROCHARS, SCM_ROUCHARS): Deprecated.
+
2000-11-21 Dirk Herrmann <D.Herrmann@tu-bs.de>
* ports.c: Include eval.h.
diff --git a/libguile/dynl.c b/libguile/dynl.c
index f9e984d6d..f554c39c0 100644
--- a/libguile/dynl.c
+++ b/libguile/dynl.c
@@ -105,7 +105,7 @@ scm_make_argv_from_stringlist (SCM args,int *argcp,const char *subr,int argn)
SCM_ASSERT (SCM_STRINGP (arg), args, argn, subr);
len = SCM_STRING_LENGTH (arg);
- src = SCM_ROCHARS (arg);
+ src = SCM_STRING_CHARS (arg);
dst = (char *) scm_must_malloc (len + 1, subr);
memcpy (dst, src, len);
dst[len] = 0;
diff --git a/libguile/filesys.c b/libguile/filesys.c
index eeb9611c8..3340fe4cb 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1349,7 +1349,7 @@ SCM_DEFINE (scm_dirname, "dirname", 1, 0, 0,
SCM_VALIDATE_STRING (1,filename);
- s = SCM_ROCHARS (filename);
+ s = SCM_STRING_CHARS (filename);
len = SCM_STRING_LENGTH (filename);
i = len - 1;
@@ -1377,7 +1377,7 @@ SCM_DEFINE (scm_basename, "basename", 1, 1, 0,
int i, j, len, end;
SCM_VALIDATE_STRING (1,filename);
- f = SCM_ROCHARS (filename);
+ f = SCM_STRING_CHARS (filename);
len = SCM_STRING_LENGTH (filename);
if (SCM_UNBNDP (suffix))
@@ -1385,7 +1385,7 @@ SCM_DEFINE (scm_basename, "basename", 1, 1, 0,
else
{
SCM_VALIDATE_STRING (2, suffix);
- s = SCM_ROCHARS (suffix);
+ s = SCM_STRING_CHARS (suffix);
j = SCM_STRING_LENGTH (suffix) - 1;
}
i = len - 1;
diff --git a/libguile/gh_data.c b/libguile/gh_data.c
index abcf27808..2d11c54a7 100644
--- a/libguile/gh_data.c
+++ b/libguile/gh_data.c
@@ -542,7 +542,7 @@ gh_scm2newstr (SCM str, int *lenp)
ret_str = (char *) scm_must_malloc ((len + 1) * sizeof (char),
"gh_scm2newstr");
/* so we copy tmp_str to ret_str, which is what we will allocate */
- memcpy (ret_str, SCM_ROCHARS (str), len); /* test ROCHARS here -twp */
+ memcpy (ret_str, SCM_STRING_CHARS (str), len);
/* from now on we don't mind if str gets GC collected. */
scm_remember (&str);
/* now make sure we null-terminate it */
@@ -573,7 +573,7 @@ gh_get_substr (SCM src, char *dst, int start, int len)
src_len = SCM_STRING_LENGTH (src);
effective_length = (len < src_len) ? len : src_len;
- memcpy (dst + start, SCM_ROCHARS (src), effective_length * sizeof (char));
+ memcpy (dst + start, SCM_STRING_CHARS (src), effective_length * sizeof (char));
/* FIXME: must signal an error if len > src_len */
scm_remember (&src);
}
diff --git a/libguile/hash.c b/libguile/hash.c
index 78ea1ab0f..b26de9c04 100644
--- a/libguile/hash.c
+++ b/libguile/hash.c
@@ -119,9 +119,8 @@ scm_hasher(SCM obj, unsigned long n, scm_sizet d)
obj = scm_number_to_string(obj, SCM_MAKINUM(10));
}
case scm_tc7_string:
- return scm_string_hash (SCM_STRING_UCHARS (obj), SCM_STRING_LENGTH (obj)) % n;
case scm_tc7_substring:
- return scm_string_hash (SCM_ROUCHARS (obj), SCM_STRING_LENGTH (obj)) % n;
+ return scm_string_hash (SCM_STRING_UCHARS (obj), SCM_STRING_LENGTH (obj)) % n;
case scm_tc7_symbol:
return SCM_SYMBOL_HASH (obj) % n;
case scm_tc7_wvect:
diff --git a/libguile/load.c b/libguile/load.c
index 54df73186..162d338d4 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -232,7 +232,7 @@ SCM_DEFINE (scm_parse_path, "parse-path", 1, 1, 0,
tail = SCM_EOL;
return (SCM_FALSEP (path)
? tail
- : scm_internal_parse_path (SCM_ROCHARS (path), tail));
+ : scm_internal_parse_path (SCM_STRING_CHARS (path), tail));
}
#undef FUNC_NAME
@@ -282,7 +282,7 @@ SCM_DEFINE (scm_search_path, "search-path", 2, 1, 0,
else
SCM_VALIDATE_LIST (3,extensions);
- filename_chars = SCM_ROCHARS (filename);
+ filename_chars = SCM_STRING_CHARS (filename);
filename_len = SCM_STRING_LENGTH (filename);
/* If FILENAME is absolute, return it unchanged. */
@@ -365,7 +365,7 @@ SCM_DEFINE (scm_search_path, "search-path", 2, 1, 0,
/* Concatenate the path name and the filename. */
len = SCM_STRING_LENGTH (dir);
- memcpy (buf, SCM_ROCHARS (dir), len);
+ memcpy (buf, SCM_STRING_CHARS (dir), len);
if (len >= 1 && buf[len - 1] != '/')
buf[len++] = '/';
memcpy (buf + len, filename_chars, filename_len);
@@ -380,7 +380,7 @@ SCM_DEFINE (scm_search_path, "search-path", 2, 1, 0,
struct stat mode;
/* Concatenate the extension. */
- memcpy (buf + len, SCM_ROCHARS (ext), ext_len);
+ memcpy (buf + len, SCM_STRING_CHARS (ext), ext_len);
buf[len + ext_len] = '\0';
/* If the file exists at all, we should return it. If the
@@ -448,7 +448,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 1, 0, 0,
if (SCM_FALSEP (full_filename))
{
int absolute = (SCM_STRING_LENGTH (filename) >= 1
- && SCM_ROCHARS (filename)[0] == '/');
+ && SCM_STRING_CHARS (filename)[0] == '/');
SCM_MISC_ERROR ((absolute
? "Unable to load file ~S"
: "Unable to find file ~S in load path"),
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 08dc14e0b..588c4a0e5 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -2808,7 +2808,7 @@ SCM_DEFINE (scm_string_to_number, "string->number", 1, 1, 0,
int base;
SCM_VALIDATE_STRING (1, string);
SCM_VALIDATE_INUM_MIN_DEF_COPY (2,radix,2,10,base);
- answer = scm_istring2number (SCM_ROCHARS (string),
+ answer = scm_istring2number (SCM_STRING_CHARS (string),
SCM_STRING_LENGTH (string),
base);
return scm_return_first (answer, string);
diff --git a/libguile/ports.c b/libguile/ports.c
index 292daa984..f94d1c7cc 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1120,7 +1120,7 @@ SCM_DEFINE (scm_unread_string, "unread-string", 2, 0, 0,
else
SCM_VALIDATE_OPINPORT (2,port);
- scm_ungets (SCM_ROCHARS (str), SCM_STRING_LENGTH (str), port);
+ scm_ungets (SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str), port);
return str;
}
diff --git a/libguile/posix.c b/libguile/posix.c
index fb7d39308..a8e88fc31 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -818,7 +818,7 @@ scm_convert_exec_args (SCM args, int argn, const char *subr)
SCM_ASSERT (SCM_STRINGP (arg), args, argn, subr);
len = SCM_STRING_LENGTH (arg);
- src = SCM_ROCHARS (arg);
+ src = SCM_STRING_CHARS (arg);
dst = (char *) scm_must_malloc (len + 1, subr);
memcpy (dst, src, len);
dst[len] = 0;
@@ -893,7 +893,7 @@ environ_list_to_c (SCM envlist, int arg, const char *proc)
SCM_ASSERT (SCM_STRINGP (str), envlist, arg, proc);
len = SCM_STRING_LENGTH (str);
- src = SCM_ROCHARS (str);
+ src = SCM_STRING_CHARS (str);
result[i] = malloc (len + 1);
if (result[i] == NULL)
scm_memory_error (proc);
@@ -1130,7 +1130,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
ptr = malloc (SCM_STRING_LENGTH (str) + 1);
if (ptr == NULL)
SCM_MEMORY_ERROR;
- strncpy (ptr, SCM_ROCHARS (str), SCM_STRING_LENGTH (str));
+ strncpy (ptr, SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str));
ptr[SCM_STRING_LENGTH (str)] = 0;
rv = putenv (ptr);
if (rv < 0)
diff --git a/libguile/print.c b/libguile/print.c
index ec80fc21b..59004fd85 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -447,7 +447,7 @@ taloop:
else if (SCM_STRINGP (name))
{
scm_putc (' ', port);
- scm_lfwrite (SCM_ROCHARS (name), SCM_STRING_LENGTH (name), port);
+ scm_lfwrite (SCM_STRING_CHARS (name), SCM_STRING_LENGTH (name), port);
}
if (!SCM_UNBNDP (code))
{
@@ -483,20 +483,19 @@ taloop:
scm_putc ('"', port);
for (i = 0; i < SCM_STRING_LENGTH (exp); ++i)
- switch (SCM_ROCHARS (exp)[i])
+ switch (SCM_STRING_CHARS (exp)[i])
{
case '"':
case '\\':
scm_putc ('\\', port);
default:
- scm_putc (SCM_ROCHARS (exp)[i], port);
+ scm_putc (SCM_STRING_CHARS (exp)[i], port);
}
scm_putc ('"', port);
break;
}
else
- scm_lfwrite (SCM_ROCHARS (exp), (scm_sizet) SCM_STRING_LENGTH (exp),
- port);
+ scm_lfwrite (SCM_STRING_CHARS (exp), SCM_STRING_LENGTH (exp), port);
break;
case scm_tc7_symbol:
{
@@ -1000,7 +999,7 @@ SCM_DEFINE (scm_simple_format, "simple-format", 2, 0, 1,
SCM_VALIDATE_STRING (2, message);
SCM_VALIDATE_REST_ARGUMENT (args);
- start = SCM_ROCHARS (message);
+ start = SCM_STRING_CHARS (message);
end = start + SCM_STRING_LENGTH (message);
for (p = start; p != end; ++p)
if (*p == '~')
diff --git a/libguile/random.c b/libguile/random.c
index dd9a75e29..b33d4e3b8 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -405,7 +405,7 @@ SCM_DEFINE (scm_seed_to_random_state, "seed->random-state", 1, 0, 0,
if (SCM_NUMBERP (seed))
seed = scm_number_to_string (seed, SCM_UNDEFINED);
SCM_VALIDATE_STRING (1,seed);
- return make_rstate (scm_c_make_rstate (SCM_ROCHARS (seed),
+ return make_rstate (scm_c_make_rstate (SCM_STRING_CHARS (seed),
SCM_STRING_LENGTH (seed)));
}
#undef FUNC_NAME
diff --git a/libguile/socket.c b/libguile/socket.c
index 3365f3ee4..23f44851d 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -431,7 +431,7 @@ scm_fill_sockaddr (int fam,SCM address,SCM *args,int which_arg,const char *proc,
memset (soka, 0, sizeof (struct sockaddr_un));
soka->sun_family = AF_UNIX;
SCM_ASSERT (SCM_STRINGP (address), address, which_arg, proc);
- memcpy (soka->sun_path, SCM_ROCHARS (address),
+ memcpy (soka->sun_path, SCM_STRING_CHARS (address),
1 + SCM_STRING_LENGTH (address));
*size = sizeof (struct sockaddr_un);
return (struct sockaddr *) soka;
@@ -738,7 +738,7 @@ SCM_DEFINE (scm_send, "send", 2, 1, 0,
SCM_VALIDATE_INUM_DEF_COPY (3,flags,0,flg);
fd = SCM_FPORT_FDES (sock);
- SCM_SYSCALL (rv = send (fd, SCM_ROCHARS (message), SCM_STRING_LENGTH (message), flg));
+ SCM_SYSCALL (rv = send (fd, SCM_STRING_CHARS (message), SCM_STRING_LENGTH (message), flg));
if (rv == -1)
SCM_SYSERROR;
return SCM_MAKINUM (rv);
@@ -856,7 +856,7 @@ SCM_DEFINE (scm_sendto, "sendto", 4, 0, 1,
SCM_VALIDATE_CONS (5,args_and_flags);
flg = SCM_NUM2ULONG (5,SCM_CAR (args_and_flags));
}
- SCM_SYSCALL (rv = sendto (fd, SCM_ROCHARS (message), SCM_STRING_LENGTH (message),
+ SCM_SYSCALL (rv = sendto (fd, SCM_STRING_CHARS (message), SCM_STRING_LENGTH (message),
flg, soka, size));
save_err = errno;
scm_must_free ((char *) soka);
diff --git a/libguile/strings.c b/libguile/strings.c
index bfd7caa9f..d17260746 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -257,7 +257,7 @@ SCM_DEFINE (scm_string_ref, "string-ref", 2, 0, 0,
SCM_VALIDATE_STRING (1, str);
SCM_VALIDATE_INUM_COPY (2, k, idx);
SCM_ASSERT_RANGE (2, k, idx >= 0 && idx < SCM_STRING_LENGTH (str));
- return SCM_MAKE_CHAR (SCM_ROUCHARS (str)[idx]);
+ return SCM_MAKE_CHAR (SCM_STRING_UCHARS (str)[idx]);
}
#undef FUNC_NAME
@@ -302,7 +302,7 @@ SCM_DEFINE (scm_substring, "substring", 2, 1, 0,
to = SCM_INUM (end);
SCM_ASSERT_RANGE (3, end, from <= to && to <= SCM_STRING_LENGTH (str));
- return scm_makfromstr (&SCM_ROCHARS (str)[from], (scm_sizet) (to - from), 0);
+ return scm_makfromstr (&SCM_STRING_CHARS (str)[from], (scm_sizet) (to - from), 0);
}
#undef FUNC_NAME
@@ -328,7 +328,7 @@ SCM_DEFINE (scm_string_append, "string-append", 0, 0, 1,
data = SCM_STRING_UCHARS (res);
for (l = args;SCM_NIMP (l);l = SCM_CDR (l)) {
s = SCM_CAR (l);
- for (i = 0;i<SCM_STRING_LENGTH (s);i++) *data++ = SCM_ROUCHARS (s)[i];
+ for (i = 0;i<SCM_STRING_LENGTH (s);i++) *data++ = SCM_STRING_UCHARS (s)[i];
}
return res;
}
diff --git a/libguile/strings.h b/libguile/strings.h
index 8503f3e32..343c655e6 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -60,7 +60,7 @@
#define SCM_STRING_COERCE_0TERMINATION_X(x) \
{ if (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_substring)) \
- x = scm_makfromstr (SCM_ROCHARS (x), SCM_STRING_LENGTH (x), 0); }
+ x = scm_makfromstr (SCM_STRING_CHARS (x), SCM_STRING_LENGTH (x), 0); }
diff --git a/libguile/strop.c b/libguile/strop.c
index fb192c0a1..ce6beeb01 100644
--- a/libguile/strop.c
+++ b/libguile/strop.c
@@ -82,7 +82,7 @@ scm_i_index (SCM *str, SCM chr, int direction, SCM sub_start,
if (direction > 0)
{
- p = (unsigned char *)SCM_ROCHARS (*str) + lower;
+ p = SCM_STRING_UCHARS (*str) + lower;
ch = SCM_CHAR (chr);
for (x = SCM_INUM (sub_start); x < upper; ++x, ++p)
@@ -91,7 +91,7 @@ scm_i_index (SCM *str, SCM chr, int direction, SCM sub_start,
}
else
{
- p = upper - 1 + (unsigned char *)SCM_ROCHARS (*str);
+ p = upper - 1 + SCM_STRING_UCHARS (*str);
ch = SCM_CHAR (chr);
for (x = upper - 1; x >= lower; --x, --p)
if (*p == ch)
@@ -327,7 +327,7 @@ SCM_DEFINE (scm_string_to_list, "string->list", 1, 0, 0,
SCM res = SCM_EOL;
unsigned char *src;
SCM_VALIDATE_STRING (1,str);
- src = SCM_ROUCHARS (str);
+ src = SCM_STRING_UCHARS (str);
for (i = SCM_STRING_LENGTH (str)-1;i >= 0;i--) res = scm_cons (SCM_MAKE_CHAR (src[i]), res);
return res;
}
@@ -341,7 +341,7 @@ SCM_DEFINE (scm_string_copy, "string-copy", 1, 0, 0,
#define FUNC_NAME s_scm_string_copy
{
SCM_VALIDATE_STRING (1, str);
- return scm_makfromstr (SCM_ROCHARS (str), SCM_STRING_LENGTH (str), 0);
+ return scm_makfromstr (SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str), 0);
}
#undef FUNC_NAME
diff --git a/libguile/strorder.c b/libguile/strorder.c
index ddb83a19d..815488a92 100644
--- a/libguile/strorder.c
+++ b/libguile/strorder.c
@@ -71,8 +71,8 @@ SCM_DEFINE1 (scm_string_equal_p, "string=?", scm_tc7_rpsubr,
length = SCM_STRING_LENGTH (s2);
if (SCM_STRING_LENGTH (s1) == length)
{
- unsigned char *c1 = SCM_ROUCHARS (s1) + length - 1;
- unsigned char *c2 = SCM_ROUCHARS (s2) + length - 1;
+ unsigned char *c1 = SCM_STRING_UCHARS (s1) + length - 1;
+ unsigned char *c2 = SCM_STRING_UCHARS (s2) + length - 1;
scm_sizet i;
/* comparing from back to front typically finds mismatches faster */
@@ -105,8 +105,8 @@ SCM_DEFINE1 (scm_string_ci_equal_p, "string-ci=?", scm_tc7_rpsubr,
length = SCM_STRING_LENGTH (s2);
if (SCM_STRING_LENGTH (s1) == length)
{
- unsigned char *c1 = SCM_ROUCHARS (s1) + length - 1;
- unsigned char *c2 = SCM_ROUCHARS (s2) + length - 1;
+ unsigned char *c1 = SCM_STRING_UCHARS (s1) + length - 1;
+ unsigned char *c2 = SCM_STRING_UCHARS (s2) + length - 1;
scm_sizet i;
/* comparing from back to front typically finds mismatches faster */
@@ -139,8 +139,8 @@ SCM_DEFINE1 (scm_string_less_p, "string<?", scm_tc7_rpsubr,
length1 = SCM_STRING_LENGTH (s1);
length2 = SCM_STRING_LENGTH (s2);
lengthm = min (length1, length2);
- c1 = SCM_ROUCHARS (s1);
- c2 = SCM_ROUCHARS (s2);
+ c1 = SCM_STRING_UCHARS (s1);
+ c2 = SCM_STRING_UCHARS (s2);
for (i = 0; i != lengthm; ++i, ++c1, ++c2) {
int c = *c1 - *c2;
@@ -202,8 +202,8 @@ SCM_DEFINE1 (scm_string_ci_less_p, "string-ci<?", scm_tc7_rpsubr,
length1 = SCM_STRING_LENGTH (s1);
length2 = SCM_STRING_LENGTH (s2);
lengthm = min (length1, length2);
- c1 = SCM_ROUCHARS (s1);
- c2 = SCM_ROUCHARS (s2);
+ c1 = SCM_STRING_UCHARS (s1);
+ c2 = SCM_STRING_UCHARS (s2);
for (i = 0; i != lengthm; ++i, ++c1, ++c2) {
int c = scm_upcase (*c1) - scm_upcase (*c2);
diff --git a/libguile/strports.c b/libguile/strports.c
index 5a52165fd..d0b9f57a6 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -282,7 +282,7 @@ scm_mkstrport (SCM pos, SCM str, long modes, const char *caller)
SCM_SET_CELL_TYPE (z, scm_tc16_strport | modes);
SCM_SETPTAB_ENTRY (z, pt);
SCM_SETSTREAM (z, SCM_UNPACK (str));
- pt->write_buf = pt->read_buf = SCM_ROUCHARS (str);
+ pt->write_buf = pt->read_buf = SCM_STRING_UCHARS (str);
pt->read_pos = pt->write_pos = pt->read_buf + SCM_INUM (pos);
pt->write_buf_size = pt->read_buf_size = str_len;
pt->write_end = pt->read_end = pt->read_buf + pt->read_buf_size;
diff --git a/libguile/struct.c b/libguile/struct.c
index 20bddc79f..e6e0c5ec6 100644
--- a/libguile/struct.c
+++ b/libguile/struct.c
@@ -88,7 +88,7 @@ SCM_DEFINE (scm_make_struct_layout, "make-struct-layout", 1, 0, 0,
int x;
len = SCM_STRING_LENGTH (fields);
- field_desc = SCM_ROCHARS (fields);
+ field_desc = SCM_STRING_CHARS (fields);
SCM_ASSERT (!(len & 1), fields, "odd length field specification", FUNC_NAME);
for (x = 0; x < len; x += 2)
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 48c438d45..17d08981c 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -498,7 +498,7 @@ SCM_DEFINE (scm_string_to_symbol, "string->symbol", 1, 0, 0,
SCM answer;
SCM_VALIDATE_STRING (1,s);
- vcell = scm_intern (SCM_ROCHARS (s), SCM_STRING_LENGTH (s));
+ vcell = scm_intern (SCM_STRING_CHARS (s), SCM_STRING_LENGTH (s));
answer = SCM_CAR (vcell);
return answer;
}
@@ -534,7 +534,7 @@ SCM_DEFINE (scm_string_to_obarray_symbol, "string->obarray-symbol", 2, 1, 0,
else if (SCM_EQ_P (o, SCM_BOOL_T))
o = SCM_BOOL_F;
- vcell = scm_intern_obarray_soft (SCM_ROCHARS(s),
+ vcell = scm_intern_obarray_soft (SCM_STRING_CHARS(s),
SCM_STRING_LENGTH (s),
o,
softness);
@@ -837,7 +837,7 @@ SCM_DEFINE (scm_gensym, "gensym", 0, 1, 0,
len = SCM_STRING_LENGTH (prefix);
if (len > MAX_PREFIX_LENGTH)
name = SCM_MUST_MALLOC (MAX_PREFIX_LENGTH + SCM_INTBUFLEN);
- strncpy (name, SCM_ROCHARS (prefix), len);
+ strncpy (name, SCM_STRING_CHARS (prefix), len);
}
{
int n_digits = scm_iint2str (gensym_counter++, 10, &name[len]);
@@ -875,7 +875,7 @@ SCM_DEFINE (scm_gentemp, "gentemp", 0, 2, 0,
len = SCM_STRING_LENGTH (prefix);
if (len > MAX_PREFIX_LENGTH)
name = SCM_MUST_MALLOC (MAX_PREFIX_LENGTH + SCM_INTBUFLEN);
- strncpy (name, SCM_ROCHARS (prefix), len);
+ strncpy (name, SCM_STRING_CHARS (prefix), len);
}
if (SCM_UNBNDP (obarray))
diff --git a/libguile/symbols.h b/libguile/symbols.h
index 6160afc49..2654cf4fe 100644
--- a/libguile/symbols.h
+++ b/libguile/symbols.h
@@ -75,17 +75,6 @@ extern int scm_symhash_dim;
#define SCM_SYMBOL_HASH(X) (SCM_CELL_WORD_2 (X))
#define SCM_SET_SYMBOL_HASH(X, v) (SCM_SET_CELL_WORD_2 ((X), (v)))
-#define SCM_ROCHARS(x) ((SCM_TYP7 (x) == scm_tc7_substring) \
- ? (SCM_INUM (SCM_CADR (x)) + SCM_STRING_CHARS (SCM_CDDR (x))) \
- : ((SCM_TYP7 (x) == scm_tc7_string) \
- ? SCM_STRING_CHARS (x) \
- : SCM_SYMBOL_CHARS (x)))
-#define SCM_ROUCHARS(x) ((SCM_TYP7 (x) == scm_tc7_substring) \
- ? (SCM_INUM (SCM_CADR (x)) + SCM_STRING_UCHARS (SCM_CDDR (x))) \
- : ((SCM_TYP7 (x) == scm_tc7_string) \
- ? SCM_STRING_UCHARS (x) \
- : SCM_SYMBOL_UCHARS (x)))
-
extern unsigned long scm_string_hash (const unsigned char *str, scm_sizet len);
@@ -134,6 +123,16 @@ extern void scm_init_symbols (void);
#define SCM_ROSTRINGP(x) (SCM_NIMP(x) && ((SCM_TYP7S(x)==scm_tc7_string) \
|| (SCM_TYP7(x) == scm_tc7_symbol)))
#define SCM_ROLENGTH(x) SCM_LENGTH (x)
+#define SCM_ROCHARS(x) ((SCM_TYP7 (x) == scm_tc7_substring) \
+ ? (SCM_INUM (SCM_CADR (x)) + SCM_STRING_CHARS (SCM_CDDR (x))) \
+ : ((SCM_TYP7 (x) == scm_tc7_string) \
+ ? SCM_STRING_CHARS (x) \
+ : SCM_SYMBOL_CHARS (x)))
+#define SCM_ROUCHARS(x) ((SCM_TYP7 (x) == scm_tc7_substring) \
+ ? (SCM_INUM (SCM_CADR (x)) + SCM_STRING_UCHARS (SCM_CDDR (x))) \
+ : ((SCM_TYP7 (x) == scm_tc7_string) \
+ ? SCM_STRING_UCHARS (x) \
+ : SCM_SYMBOL_UCHARS (x)))
#define SCM_SUBSTRP(x) (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_substring))
#define SCM_COERCE_SUBSTR(x) SCM_STRING_COERCE_0TERMINATION_X (x)
#define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))