mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-05 11:40:20 +02:00
* Deprecated macros SCM_ROCHARS and SCM_ROUCHARS.
This commit is contained in:
parent
395d8627b9
commit
34f0f2b8af
22 changed files with 86 additions and 63 deletions
5
NEWS
5
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
|
||||
|
||||
|
|
3
RELEASE
3
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])
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 == '~')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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); }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue