1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 12:20:26 +02:00

(scm_string_any, scm_string_every, scm_string_to_listS)

(scm_string_trim, scm_string_trim_right)
(scm_string_trim_right, scm_string_trim_both)
(scm_string_compare, scm_string_compare_ci, scm_string_eq)
(scm_string_neq, scm_string_lt, scm_string_gt)
(scm_string_le, scm_string_ge, scm_string_ci_eq)
(scm_string_ci_neq, scm_string_ci_lt, scm_string_ci_gt)
(scm_string_ci_le, scm_string_ci_ge, scm_string_indexS)
(scm_string_index_right, scm_string_skip)
(scm_string_skip_right, scm_string_count, scm_string_map)
(scm_string_map_x, scm_string_fold, scm_string_fold_right)
(scm_string_for_each, scm_string_filter, scm_string_delete): Fix
char vs unsigned char mismatches in various function calls.  For
the most part, this means adding a char * alias to existing
unsigned char * for calls to SCM_VALIDATE_SUBSTRING_SPEC_COPY
which won't accept a simple coercion and requires a char *.  There
were also some calls to scm_mem2string() and SCM_STRING_CHARS()
that needed to be fixed.
This commit is contained in:
Rob Browning 2005-10-15 01:55:36 +00:00
parent 042121e055
commit 1fbd9e82cc

View file

@ -61,13 +61,15 @@ SCM_DEFINE (scm_string_any, "string-any-c-code", 2, 2, 0,
"successful application of @var{pred}.") "successful application of @var{pred}.")
#define FUNC_NAME s_scm_string_any #define FUNC_NAME s_scm_string_any
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM res; SCM res;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
return (memchr (cstr+cstart, (int) SCM_CHAR (char_pred), return (memchr (cstr+cstart, (int) SCM_CHAR (char_pred),
@ -108,13 +110,15 @@ SCM_DEFINE (scm_string_every, "string-every-c-code", 2, 2, 0,
"application of @var{pred} to the last character of @var{s}.") "application of @var{pred} to the last character of @var{s}.")
#define FUNC_NAME s_scm_string_every #define FUNC_NAME s_scm_string_every
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM res; SCM res;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
char cchr = SCM_CHAR (char_pred); char cchr = SCM_CHAR (char_pred);
@ -189,13 +193,15 @@ SCM_DEFINE (scm_string_to_listS, "string->list", 1, 2, 0,
"Convert the string @var{str} into a list of characters.") "Convert the string @var{str} into a list of characters.")
#define FUNC_NAME s_scm_string_to_listS #define FUNC_NAME s_scm_string_to_listS
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM result = SCM_EOL; SCM result = SCM_EOL;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr_copy,
2, start, cstart, 2, start, cstart,
3, end, cend); 3, end, cend);
cstr = (unsigned char *) cstr_copy;
while (cstart < cend) while (cstart < cend)
{ {
cend--; cend--;
@ -645,12 +651,14 @@ SCM_DEFINE (scm_string_trim, "string-trim", 1, 3, 0,
"trimmed.") "trimmed.")
#define FUNC_NAME s_scm_string_trim #define FUNC_NAME s_scm_string_trim
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_UNBNDP (char_pred)) if (SCM_UNBNDP (char_pred))
{ {
while (cstart < cend) while (cstart < cend)
@ -692,7 +700,7 @@ SCM_DEFINE (scm_string_trim, "string-trim", 1, 3, 0,
cstart++; cstart++;
} }
} }
return scm_mem2string (cstr + cstart, cend - cstart); return scm_mem2string ((char *) (cstr + cstart), cend - cstart);
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -720,12 +728,14 @@ SCM_DEFINE (scm_string_trim_right, "string-trim-right", 1, 3, 0,
"trimmed.") "trimmed.")
#define FUNC_NAME s_scm_string_trim_right #define FUNC_NAME s_scm_string_trim_right
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_UNBNDP (char_pred)) if (SCM_UNBNDP (char_pred))
{ {
while (cstart < cend) while (cstart < cend)
@ -767,7 +777,7 @@ SCM_DEFINE (scm_string_trim_right, "string-trim-right", 1, 3, 0,
cend--; cend--;
} }
} }
return scm_mem2string (cstr + cstart, cend - cstart); return scm_mem2string ((char *) (cstr + cstart), cend - cstart);
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -795,12 +805,14 @@ SCM_DEFINE (scm_string_trim_both, "string-trim-both", 1, 3, 0,
"trimmed.") "trimmed.")
#define FUNC_NAME s_scm_string_trim_both #define FUNC_NAME s_scm_string_trim_both
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_UNBNDP (char_pred)) if (SCM_UNBNDP (char_pred))
{ {
while (cstart < cend) while (cstart < cend)
@ -869,7 +881,7 @@ SCM_DEFINE (scm_string_trim_both, "string-trim-both", 1, 3, 0,
cend--; cend--;
} }
} }
return scm_mem2string (cstr + cstart, cend - cstart); return scm_mem2string ((char *) (cstr + cstart), cend - cstart);
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -906,15 +918,20 @@ SCM_DEFINE (scm_string_compare, "string-compare", 5, 4, 0,
"@var{i} is the first position that does not match.") "@var{i} is the first position that does not match.")
#define FUNC_NAME s_scm_string_compare #define FUNC_NAME s_scm_string_compare
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
6, start1, cstart1, 6, start1, cstart1,
7, end1, cend1); 7, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
8, start2, cstart2, 8, start2, cstart2,
9, end2, cend2); 9, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
SCM_VALIDATE_PROC (3, proc_lt); SCM_VALIDATE_PROC (3, proc_lt);
SCM_VALIDATE_PROC (4, proc_eq); SCM_VALIDATE_PROC (4, proc_eq);
SCM_VALIDATE_PROC (5, proc_gt); SCM_VALIDATE_PROC (5, proc_gt);
@ -949,15 +966,20 @@ SCM_DEFINE (scm_string_compare_ci, "string-compare-ci", 5, 4, 0,
"character comparison is done case-insensitively.") "character comparison is done case-insensitively.")
#define FUNC_NAME s_scm_string_compare_ci #define FUNC_NAME s_scm_string_compare_ci
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
6, start1, cstart1, 6, start1, cstart1,
7, end1, cend1); 7, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
8, start2, cstart2, 8, start2, cstart2,
9, end2, cend2); 9, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
SCM_VALIDATE_PROC (3, proc_lt); SCM_VALIDATE_PROC (3, proc_lt);
SCM_VALIDATE_PROC (4, proc_eq); SCM_VALIDATE_PROC (4, proc_eq);
SCM_VALIDATE_PROC (5, proc_gt); SCM_VALIDATE_PROC (5, proc_gt);
@ -987,15 +1009,20 @@ SCM_DEFINE (scm_string_eq, "string=", 2, 4, 0,
"value otherwise.") "value otherwise.")
#define FUNC_NAME s_scm_string_eq #define FUNC_NAME s_scm_string_eq
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1022,16 +1049,21 @@ SCM_DEFINE (scm_string_neq, "string<>", 2, 4, 0,
"value otherwise.") "value otherwise.")
#define FUNC_NAME s_scm_string_neq #define FUNC_NAME s_scm_string_neq
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
if (cstr1[cstart1] < cstr2[cstart2]) if (cstr1[cstart1] < cstr2[cstart2])
@ -1057,15 +1089,20 @@ SCM_DEFINE (scm_string_lt, "string<", 2, 4, 0,
"true value otherwise.") "true value otherwise.")
#define FUNC_NAME s_scm_string_lt #define FUNC_NAME s_scm_string_lt
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1092,15 +1129,20 @@ SCM_DEFINE (scm_string_gt, "string>", 2, 4, 0,
"true value otherwise.") "true value otherwise.")
#define FUNC_NAME s_scm_string_gt #define FUNC_NAME s_scm_string_gt
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1127,15 +1169,20 @@ SCM_DEFINE (scm_string_le, "string<=", 2, 4, 0,
"value otherwise.") "value otherwise.")
#define FUNC_NAME s_scm_string_le #define FUNC_NAME s_scm_string_le
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1162,15 +1209,20 @@ SCM_DEFINE (scm_string_ge, "string>=", 2, 4, 0,
"otherwise.") "otherwise.")
#define FUNC_NAME s_scm_string_ge #define FUNC_NAME s_scm_string_ge
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1198,15 +1250,20 @@ SCM_DEFINE (scm_string_ci_eq, "string-ci=", 2, 4, 0,
"case-insensitively.") "case-insensitively.")
#define FUNC_NAME s_scm_string_ci_eq #define FUNC_NAME s_scm_string_ci_eq
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1234,15 +1291,20 @@ SCM_DEFINE (scm_string_ci_neq, "string-ci<>", 2, 4, 0,
"case-insensitively.") "case-insensitively.")
#define FUNC_NAME s_scm_string_ci_neq #define FUNC_NAME s_scm_string_ci_neq
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1270,15 +1332,20 @@ SCM_DEFINE (scm_string_ci_lt, "string-ci<", 2, 4, 0,
"case-insensitively.") "case-insensitively.")
#define FUNC_NAME s_scm_string_ci_lt #define FUNC_NAME s_scm_string_ci_lt
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1306,15 +1373,20 @@ SCM_DEFINE (scm_string_ci_gt, "string-ci>", 2, 4, 0,
"case-insensitively.") "case-insensitively.")
#define FUNC_NAME s_scm_string_ci_gt #define FUNC_NAME s_scm_string_ci_gt
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1342,15 +1414,20 @@ SCM_DEFINE (scm_string_ci_le, "string-ci<=", 2, 4, 0,
"case-insensitively.") "case-insensitively.")
#define FUNC_NAME s_scm_string_ci_le #define FUNC_NAME s_scm_string_ci_le
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1378,15 +1455,20 @@ SCM_DEFINE (scm_string_ci_ge, "string-ci>=", 2, 4, 0,
"case-insensitively.") "case-insensitively.")
#define FUNC_NAME s_scm_string_ci_ge #define FUNC_NAME s_scm_string_ci_ge
{ {
unsigned char * cstr1, * cstr2; char * cstr1_copy;
char * cstr2_copy;
unsigned char * cstr1;
unsigned char * cstr2;
int cstart1, cend1, cstart2, cend2; int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1_copy,
3, start1, cstart1, 3, start1, cstart1,
4, end1, cend1); 4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2, cstr1 = (unsigned char *) cstr1_copy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2_copy,
5, start2, cstart2, 5, start2, cstart2,
6, end2, cend2); 6, end2, cend2);
cstr2 = (unsigned char *) cstr2_copy;
while (cstart1 < cend1 && cstart2 < cend2) while (cstart1 < cend1 && cstart2 < cend2)
{ {
@ -1658,12 +1740,14 @@ SCM_DEFINE (scm_string_indexS, "string-index", 2, 2, 0,
"@end itemize") "@end itemize")
#define FUNC_NAME s_scm_string_indexS #define FUNC_NAME s_scm_string_indexS
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
char cchr = SCM_CHAR (char_pred); char cchr = SCM_CHAR (char_pred);
@ -1717,12 +1801,14 @@ SCM_DEFINE (scm_string_index_right, "string-index-right", 2, 2, 0,
"@end itemize") "@end itemize")
#define FUNC_NAME s_scm_string_index_right #define FUNC_NAME s_scm_string_index_right
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
char cchr = SCM_CHAR (char_pred); char cchr = SCM_CHAR (char_pred);
@ -1777,12 +1863,14 @@ SCM_DEFINE (scm_string_skip, "string-skip", 2, 2, 0,
"@end itemize") "@end itemize")
#define FUNC_NAME s_scm_string_skip #define FUNC_NAME s_scm_string_skip
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
char cchr = SCM_CHAR (char_pred); char cchr = SCM_CHAR (char_pred);
@ -1837,12 +1925,14 @@ SCM_DEFINE (scm_string_skip_right, "string-skip-right", 2, 2, 0,
"@end itemize") "@end itemize")
#define FUNC_NAME s_scm_string_skip_right #define FUNC_NAME s_scm_string_skip_right
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
char cchr = SCM_CHAR (char_pred); char cchr = SCM_CHAR (char_pred);
@ -1896,13 +1986,15 @@ SCM_DEFINE (scm_string_count, "string-count", 2, 2, 0,
"@end itemize") "@end itemize")
#define FUNC_NAME s_scm_string_count #define FUNC_NAME s_scm_string_count
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
int count = 0; int count = 0;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
char cchr = SCM_CHAR (char_pred); char cchr = SCM_CHAR (char_pred);
@ -2442,16 +2534,19 @@ SCM_DEFINE (scm_string_map, "string-map", 2, 2, 0,
"string elements is not specified.") "string elements is not specified.")
#define FUNC_NAME s_scm_string_map #define FUNC_NAME s_scm_string_map
{ {
unsigned char * cstr, *p; char * cstr_copy;
unsigned char * cstr;
unsigned char *p;
int cstart, cend; int cstart, cend;
SCM result; SCM result;
SCM_VALIDATE_PROC (1, proc); SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
result = scm_allocate_string (cend - cstart); result = scm_allocate_string (cend - cstart);
p = SCM_STRING_CHARS (result); p = (unsigned char *) (SCM_STRING_CHARS (result));
while (cstart < cend) while (cstart < cend)
{ {
SCM ch = scm_call_1 (proc, SCM_MAKE_CHAR (cstr[cstart])); SCM ch = scm_call_1 (proc, SCM_MAKE_CHAR (cstr[cstart]));
@ -2473,14 +2568,17 @@ SCM_DEFINE (scm_string_map_x, "string-map!", 2, 2, 0,
"modified in-place, the return value is not specified.") "modified in-place, the return value is not specified.")
#define FUNC_NAME s_scm_string_map_x #define FUNC_NAME s_scm_string_map_x
{ {
unsigned char * cstr, *p; char * cstr_copy;
unsigned char * cstr;
unsigned char *p;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_PROC (1, proc); SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
p = SCM_STRING_CHARS (s) + cstart; cstr = (unsigned char *) cstr_copy;
p = (unsigned char *) (SCM_STRING_CHARS (s) + cstart);
while (cstart < cend) while (cstart < cend)
{ {
SCM ch = scm_call_1 (proc, SCM_MAKE_CHAR (cstr[cstart])); SCM ch = scm_call_1 (proc, SCM_MAKE_CHAR (cstr[cstart]));
@ -2502,14 +2600,16 @@ SCM_DEFINE (scm_string_fold, "string-fold", 3, 2, 0,
"result of @var{kons}' application.") "result of @var{kons}' application.")
#define FUNC_NAME s_scm_string_fold #define FUNC_NAME s_scm_string_fold
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM result; SCM result;
SCM_VALIDATE_PROC (1, kons); SCM_VALIDATE_PROC (1, kons);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr_copy,
4, start, cstart, 4, start, cstart,
5, end, cend); 5, end, cend);
cstr = (unsigned char *) cstr_copy;
result = knil; result = knil;
while (cstart < cend) while (cstart < cend)
{ {
@ -2529,14 +2629,16 @@ SCM_DEFINE (scm_string_fold_right, "string-fold-right", 3, 2, 0,
"result of @var{kons}' application.") "result of @var{kons}' application.")
#define FUNC_NAME s_scm_string_fold_right #define FUNC_NAME s_scm_string_fold_right
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM result; SCM result;
SCM_VALIDATE_PROC (1, kons); SCM_VALIDATE_PROC (1, kons);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr_copy,
4, start, cstart, 4, start, cstart,
5, end, cend); 5, end, cend);
cstr = (unsigned char *) cstr_copy;
result = knil; result = knil;
while (cstart < cend) while (cstart < cend)
{ {
@ -2678,13 +2780,15 @@ SCM_DEFINE (scm_string_for_each, "string-for-each", 2, 2, 0,
"return value is not specified.") "return value is not specified.")
#define FUNC_NAME s_scm_string_for_each #define FUNC_NAME s_scm_string_for_each
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM_VALIDATE_PROC (1, proc); SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
while (cstart < cend) while (cstart < cend)
{ {
scm_call_1 (proc, SCM_MAKE_CHAR (cstr[cstart])); scm_call_1 (proc, SCM_MAKE_CHAR (cstr[cstart]));
@ -2914,14 +3018,17 @@ SCM_DEFINE (scm_string_filter, "string-filter", 2, 2, 0,
"character set, it is tested for membership.") "character set, it is tested for membership.")
#define FUNC_NAME s_scm_string_filter #define FUNC_NAME s_scm_string_filter
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM result; SCM result;
int idx; int idx;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
SCM ls = SCM_EOL; SCM ls = SCM_EOL;
@ -2980,14 +3087,17 @@ SCM_DEFINE (scm_string_delete, "string-delete", 2, 2, 0,
"character set, it is tested for membership.") "character set, it is tested for membership.")
#define FUNC_NAME s_scm_string_delete #define FUNC_NAME s_scm_string_delete
{ {
char * cstr_copy;
unsigned char * cstr; unsigned char * cstr;
int cstart, cend; int cstart, cend;
SCM result; SCM result;
int idx; int idx;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr, SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr_copy,
3, start, cstart, 3, start, cstart,
4, end, cend); 4, end, cend);
cstr = (unsigned char *) cstr_copy;
if (SCM_CHARP (char_pred)) if (SCM_CHARP (char_pred))
{ {
SCM ls = SCM_EOL; SCM ls = SCM_EOL;