1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

(MY_VALIDATE_SUBSTRING_SPEC_COPY, MY_VALIDATE_STRING_COPY): Modernized

clones of the deprecated validation macros.  Replaced every use.
This commit is contained in:
Marius Vollmer 2004-08-12 17:49:59 +00:00
parent 8824ac88f0
commit 57d4d32fa3

View file

@ -26,6 +26,32 @@
#include "srfi-13.h"
#include "srfi-14.h"
/* SCM_VALIDATE_SUBSTRING_SPEC_COPY is deprecated since it encourages
messing with the internal representation of strings. We define our
own version since we use it so much and are messing with Guile
internals anyway.
*/
#define MY_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \
pos_start, start, c_start, \
pos_end, end, c_end) \
do { \
SCM_VALIDATE_STRING (pos_str, str); \
c_str = SCM_I_STRING_CHARS (str); \
scm_i_get_substring_spec (SCM_I_STRING_LENGTH (str), \
start, &c_start, end, &c_end); \
} while (0)
/* Likewise for SCM_VALIDATE_STRING_COPY. */
#define MY_VALIDATE_STRING_COPY(pos, str, cvar) \
do { \
SCM_VALIDATE_STRING (pos, str); \
cvar = SCM_I_STRING_CHARS(str); \
} while (0)
SCM_DEFINE (scm_string_any, "string-any", 2, 2, 0,
(SCM pred, SCM s, SCM start, SCM end),
"Check if the predicate @var{pred} is true for any character in\n"
@ -46,7 +72,7 @@ SCM_DEFINE (scm_string_any, "string-any", 2, 2, 0,
SCM res;
SCM_VALIDATE_PROC (1, pred);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
cstr += cstart;
@ -87,7 +113,7 @@ SCM_DEFINE (scm_string_every, "string-every", 2, 2, 0,
SCM res;
SCM_VALIDATE_PROC (1, pred);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
res = SCM_BOOL_T;
@ -147,7 +173,7 @@ SCM_DEFINE (scm_string_to_listS, "string->list", 1, 2, 0,
int cstart, cend;
SCM result = SCM_EOL;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
while (cstart < cend)
@ -366,7 +392,7 @@ SCM_DEFINE (scm_string_copyS, "string-copy", 1, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
return scm_mem2string (cstr + cstart, cend - cstart);
@ -412,10 +438,10 @@ SCM_DEFINE (scm_string_copy_x, "string-copy!", 3, 2, 0,
int len;
SCM sdummy = SCM_UNDEFINED;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, target, ctarget,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, target, ctarget,
2, tstart, ctstart,
2, sdummy, dummy);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr,
4, start, cstart,
5, end, cend);
len = cend - cstart;
@ -437,7 +463,7 @@ SCM_DEFINE (scm_string_take, "string-take", 2, 0, 0,
char * cstr;
size_t cn;
SCM_VALIDATE_STRING_COPY (1, s, cstr);
MY_VALIDATE_STRING_COPY (1, s, cstr);
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
return scm_mem2string (cstr, cn);
@ -453,7 +479,7 @@ SCM_DEFINE (scm_string_drop, "string-drop", 2, 0, 0,
char * cstr;
size_t cn;
SCM_VALIDATE_STRING_COPY (1, s, cstr);
MY_VALIDATE_STRING_COPY (1, s, cstr);
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
return scm_mem2string (cstr + cn, SCM_STRING_LENGTH (s) - cn);
@ -469,7 +495,7 @@ SCM_DEFINE (scm_string_take_right, "string-take-right", 2, 0, 0,
char * cstr;
size_t cn;
SCM_VALIDATE_STRING_COPY (1, s, cstr);
MY_VALIDATE_STRING_COPY (1, s, cstr);
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
return scm_mem2string (cstr + SCM_STRING_LENGTH (s) - cn, cn);
@ -485,7 +511,7 @@ SCM_DEFINE (scm_string_drop_right, "string-drop-right", 2, 0, 0,
char * cstr;
size_t cn;
SCM_VALIDATE_STRING_COPY (1, s, cstr);
MY_VALIDATE_STRING_COPY (1, s, cstr);
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
return scm_mem2string (cstr, SCM_STRING_LENGTH (s) - cn);
@ -506,7 +532,7 @@ SCM_DEFINE (scm_string_pad, "string-pad", 2, 3, 0,
size_t cstart, cend, clen;
SCM result;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
4, start, cstart,
5, end, cend);
clen = scm_to_size_t (len);
@ -549,7 +575,7 @@ SCM_DEFINE (scm_string_pad_right, "string-pad-right", 2, 3, 0,
size_t cstart, cend, clen;
SCM result;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
4, start, cstart,
5, end, cend);
clen = scm_to_size_t (len);
@ -601,7 +627,7 @@ SCM_DEFINE (scm_string_trim, "string-trim", 1, 3, 0,
char * cstr;
size_t cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_UNBNDP (char_pred))
@ -676,7 +702,7 @@ SCM_DEFINE (scm_string_trim_right, "string-trim-right", 1, 3, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_UNBNDP (char_pred))
@ -751,7 +777,7 @@ SCM_DEFINE (scm_string_trim_both, "string-trim-both", 1, 3, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_UNBNDP (char_pred))
@ -838,7 +864,7 @@ SCM_DEFINE (scm_string_fill_xS, "string-fill!", 2, 2, 0,
int c;
long k;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
3, start, cstart,
4, end, cend);
SCM_VALIDATE_CHAR_COPY (2, chr, c);
@ -862,10 +888,10 @@ SCM_DEFINE (scm_string_compare, "string-compare", 5, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
6, start1, cstart1,
7, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
8, start2, cstart2,
9, end2, cend2);
SCM_VALIDATE_PROC (3, proc_lt);
@ -905,10 +931,10 @@ SCM_DEFINE (scm_string_compare_ci, "string-compare-ci", 5, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
6, start1, cstart1,
7, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
8, start2, cstart2,
9, end2, cend2);
SCM_VALIDATE_PROC (3, proc_lt);
@ -943,10 +969,10 @@ SCM_DEFINE (scm_string_eq, "string=", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -978,10 +1004,10 @@ SCM_DEFINE (scm_string_neq, "string<>", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1013,10 +1039,10 @@ SCM_DEFINE (scm_string_lt, "string<", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1048,10 +1074,10 @@ SCM_DEFINE (scm_string_gt, "string>", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1083,10 +1109,10 @@ SCM_DEFINE (scm_string_le, "string<=", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1118,10 +1144,10 @@ SCM_DEFINE (scm_string_ge, "string>=", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1154,10 +1180,10 @@ SCM_DEFINE (scm_string_ci_eq, "string-ci=", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1190,10 +1216,10 @@ SCM_DEFINE (scm_string_ci_neq, "string-ci<>", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1226,10 +1252,10 @@ SCM_DEFINE (scm_string_ci_lt, "string-ci<", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1262,10 +1288,10 @@ SCM_DEFINE (scm_string_ci_gt, "string-ci>", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1298,10 +1324,10 @@ SCM_DEFINE (scm_string_ci_le, "string-ci<=", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1334,10 +1360,10 @@ SCM_DEFINE (scm_string_ci_ge, "string-ci>=", 2, 4, 0,
char * cstr1, * cstr2;
int cstart1, cend1, cstart2, cend2;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
@ -1370,10 +1396,10 @@ SCM_DEFINE (scm_string_prefix_length, "string-prefix-length", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
while (cstart1 < cend1 && cstart2 < cend2)
@ -1399,10 +1425,10 @@ SCM_DEFINE (scm_string_prefix_length_ci, "string-prefix-length-ci", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
while (cstart1 < cend1 && cstart2 < cend2)
@ -1428,10 +1454,10 @@ SCM_DEFINE (scm_string_suffix_length, "string-suffix-length", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
while (cstart1 < cend1 && cstart2 < cend2)
@ -1457,10 +1483,10 @@ SCM_DEFINE (scm_string_suffix_length_ci, "string-suffix-length-ci", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
while (cstart1 < cend1 && cstart2 < cend2)
@ -1485,10 +1511,10 @@ SCM_DEFINE (scm_string_prefix_p, "string-prefix?", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0, len1;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
len1 = cend1 - cstart1;
@ -1514,10 +1540,10 @@ SCM_DEFINE (scm_string_prefix_ci_p, "string-prefix-ci?", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0, len1;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
len1 = cend1 - cstart1;
@ -1543,10 +1569,10 @@ SCM_DEFINE (scm_string_suffix_p, "string-suffix?", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0, len1;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
len1 = cend1 - cstart1;
@ -1572,10 +1598,10 @@ SCM_DEFINE (scm_string_suffix_ci_p, "string-suffix-ci?", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len = 0, len1;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
len1 = cend1 - cstart1;
@ -1614,7 +1640,7 @@ SCM_DEFINE (scm_string_indexS, "string-index", 2, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_CHARP (char_pred))
@ -1673,7 +1699,7 @@ SCM_DEFINE (scm_string_index_right, "string-index-right", 2, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_CHARP (char_pred))
@ -1733,7 +1759,7 @@ SCM_DEFINE (scm_string_skip, "string-skip", 2, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_CHARP (char_pred))
@ -1793,7 +1819,7 @@ SCM_DEFINE (scm_string_skip_right, "string-skip-right", 2, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_CHARP (char_pred))
@ -1853,7 +1879,7 @@ SCM_DEFINE (scm_string_count, "string-count", 2, 2, 0,
int cstart, cend;
int count = 0;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_CHARP (char_pred))
@ -1907,10 +1933,10 @@ SCM_DEFINE (scm_string_contains, "string-contains", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len2, i, j;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cs1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cs1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cs2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cs2,
5, start2, cstart2,
6, end2, cend2);
len2 = cend2 - cstart2;
@ -1948,10 +1974,10 @@ SCM_DEFINE (scm_string_contains_ci, "string-contains-ci", 2, 4, 0,
int cstart1, cend1, cstart2, cend2;
int len2, i, j;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cs1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cs1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cs2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cs2,
5, start2, cstart2,
6, end2, cend2);
len2 = cend2 - cstart2;
@ -2005,7 +2031,7 @@ SCM_DEFINE (scm_string_upcase_xS, "string-upcase!", 1, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
return string_upcase_x (str, cstart, cend);
@ -2023,7 +2049,7 @@ SCM_DEFINE (scm_string_upcaseS, "string-upcase", 1, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
return string_upcase_x (scm_string_copy (str), cstart, cend);
@ -2064,7 +2090,7 @@ SCM_DEFINE (scm_string_downcase_xS, "string-downcase!", 1, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
return string_downcase_x (str, cstart, cend);
@ -2082,7 +2108,7 @@ SCM_DEFINE (scm_string_downcaseS, "string-downcase", 1, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
return string_downcase_x (scm_string_copy (str), cstart, cend);
@ -2129,7 +2155,7 @@ SCM_DEFINE (scm_string_titlecase_x, "string-titlecase!", 1, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
return string_titlecase_x (str, cstart, cend);
@ -2145,7 +2171,7 @@ SCM_DEFINE (scm_string_titlecase, "string-titlecase", 1, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
return string_titlecase_x (scm_string_copy (str), cstart, cend);
@ -2184,7 +2210,7 @@ SCM_DEFINE (scm_string_reverse, "string-reverse", 1, 2, 0,
int cend;
SCM result;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
result = scm_string_copy (str);
@ -2205,7 +2231,7 @@ SCM_DEFINE (scm_string_reverse_x, "string-reverse!", 1, 2, 0,
int cstart;
int cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, str, cstr,
2, start, cstart,
3, end, cend);
string_reverse_x (SCM_STRING_CHARS (str), cstart, cend);
@ -2398,7 +2424,7 @@ SCM_DEFINE (scm_string_map, "string-map", 2, 2, 0,
SCM result;
SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
result = scm_allocate_string (cend - cstart);
@ -2429,7 +2455,7 @@ SCM_DEFINE (scm_string_map_x, "string-map!", 2, 2, 0,
int cstart, cend;
SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
p = SCM_STRING_CHARS (s) + cstart;
@ -2460,7 +2486,7 @@ SCM_DEFINE (scm_string_fold, "string-fold", 3, 2, 0,
SCM result;
SCM_VALIDATE_PROC (1, kons);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr,
4, start, cstart,
5, end, cend);
result = knil;
@ -2488,7 +2514,7 @@ SCM_DEFINE (scm_string_fold_right, "string-fold-right", 3, 2, 0,
SCM result;
SCM_VALIDATE_PROC (1, kons);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cstr,
4, start, cstart,
5, end, cend);
result = knil;
@ -2637,7 +2663,7 @@ SCM_DEFINE (scm_string_for_each, "string-for-each", 2, 2, 0,
int cstart, cend;
SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
while (cstart < cend)
@ -2660,7 +2686,7 @@ SCM_DEFINE (scm_string_for_each_index, "string-for-each-index", 2, 2, 0,
int cstart, cend;
SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
while (cstart < cend)
@ -2690,7 +2716,7 @@ SCM_DEFINE (scm_xsubstring, "xsubstring", 2, 3, 0,
size_t cstart, cend, cfrom, cto;
SCM result;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cs,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cs,
4, start, cstart,
5, end, cend);
cfrom = scm_to_size_t (from);
@ -2733,10 +2759,10 @@ SCM_DEFINE (scm_string_xcopy_x, "string-xcopy!", 4, 3, 0,
SCM dummy = SCM_UNDEFINED;
int cdummy;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, target, ctarget,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, target, ctarget,
2, tstart, ctstart,
2, dummy, cdummy);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cs,
MY_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cs,
6, start, cstart,
7, end, cend);
csfrom = scm_to_size_t (sfrom);
@ -2776,10 +2802,10 @@ SCM_DEFINE (scm_string_replace, "string-replace", 2, 4, 0,
size_t cstart1, cend1, cstart2, cend2;
SCM result;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
3, start1, cstart1,
4, end1, cend1);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
MY_VALIDATE_SUBSTRING_SPEC_COPY (2, s2, cstr2,
5, start2, cstart2,
6, end2, cend2);
result = scm_allocate_string (cstart1 + (cend2 - cstart2) +
@ -2812,7 +2838,7 @@ SCM_DEFINE (scm_string_tokenize, "string-tokenize", 1, 3, 0,
static SCM charset_graphic = SCM_BOOL_F;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
@ -2873,7 +2899,7 @@ SCM_DEFINE (scm_string_filter, "string-filter", 2, 2, 0,
SCM result;
int idx;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_CHARP (char_pred))
@ -2939,7 +2965,7 @@ SCM_DEFINE (scm_string_delete, "string-delete", 2, 2, 0,
SCM result;
int idx;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
MY_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
3, start, cstart,
4, end, cend);
if (SCM_CHARP (char_pred))