mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Changed all uses of SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN, SCM_VALIDATE_INUM_MIN_COPY, SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF, SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE, SCM_VALIDATE_INUM_RANGE_COPY to scm_to_size_t or similar.
This commit is contained in:
parent
8805b77dd0
commit
1a161b8ece
3 changed files with 90 additions and 105 deletions
|
@ -97,13 +97,13 @@ SCM_DEFINE (scm_string_tabulate, "string-tabulate", 2, 0, 0,
|
||||||
"@var{proc} is applied to the indices is not specified.")
|
"@var{proc} is applied to the indices is not specified.")
|
||||||
#define FUNC_NAME s_scm_string_tabulate
|
#define FUNC_NAME s_scm_string_tabulate
|
||||||
{
|
{
|
||||||
int clen, i;
|
size_t clen, i;
|
||||||
SCM res;
|
SCM res;
|
||||||
SCM ch;
|
SCM ch;
|
||||||
char * p;
|
char * p;
|
||||||
|
|
||||||
SCM_VALIDATE_PROC (1, proc);
|
SCM_VALIDATE_PROC (1, proc);
|
||||||
SCM_VALIDATE_INUM_COPY (2, len, clen);
|
clen = scm_to_size_t (len);
|
||||||
SCM_ASSERT_RANGE (2, len, clen >= 0);
|
SCM_ASSERT_RANGE (2, len, clen >= 0);
|
||||||
|
|
||||||
res = scm_allocate_string (clen);
|
res = scm_allocate_string (clen);
|
||||||
|
@ -111,7 +111,7 @@ SCM_DEFINE (scm_string_tabulate, "string-tabulate", 2, 0, 0,
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < clen)
|
while (i < clen)
|
||||||
{
|
{
|
||||||
ch = scm_call_1 (proc, SCM_I_MAKINUM (i));
|
ch = scm_call_1 (proc, scm_from_int (i));
|
||||||
if (!SCM_CHARP (ch))
|
if (!SCM_CHARP (ch))
|
||||||
SCM_MISC_ERROR ("procedure ~S returned non-char", scm_list_1 (proc));
|
SCM_MISC_ERROR ("procedure ~S returned non-char", scm_list_1 (proc));
|
||||||
*p++ = SCM_CHAR (ch);
|
*p++ = SCM_CHAR (ch);
|
||||||
|
@ -365,16 +365,17 @@ SCM_DEFINE (scm_substring_shared, "substring/shared", 2, 1, 0,
|
||||||
"argument @var{str}.")
|
"argument @var{str}.")
|
||||||
#define FUNC_NAME s_scm_substring_shared
|
#define FUNC_NAME s_scm_substring_shared
|
||||||
{
|
{
|
||||||
|
size_t s, e;
|
||||||
SCM_VALIDATE_STRING (1, str);
|
SCM_VALIDATE_STRING (1, str);
|
||||||
SCM_VALIDATE_INUM (2, start);
|
s = scm_to_size_t (start);
|
||||||
if (SCM_UNBNDP (end))
|
if (SCM_UNBNDP (end))
|
||||||
end = SCM_I_MAKINUM (SCM_STRING_LENGTH (str));
|
e = SCM_STRING_LENGTH (str);
|
||||||
else
|
else
|
||||||
SCM_VALIDATE_INUM (3, end);
|
e = scm_to_size_t (end);
|
||||||
if (SCM_INUM (start) == 0 &&
|
if (s == 0 && e == SCM_STRING_LENGTH (str))
|
||||||
SCM_INUM (end) == SCM_STRING_LENGTH (str))
|
|
||||||
return str;
|
return str;
|
||||||
return scm_substring (str, start, end);
|
else
|
||||||
|
return scm_substring (str, start, end);
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
@ -418,11 +419,10 @@ SCM_DEFINE (scm_string_take, "string-take", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_string_take
|
#define FUNC_NAME s_scm_string_take
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cn;
|
size_t cn;
|
||||||
|
|
||||||
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
||||||
SCM_VALIDATE_INUM_COPY (2, n, cn);
|
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
|
||||||
SCM_ASSERT_RANGE (2, n, cn >= 0 && cn <= SCM_STRING_LENGTH (s));
|
|
||||||
|
|
||||||
return scm_mem2string (cstr, cn);
|
return scm_mem2string (cstr, cn);
|
||||||
}
|
}
|
||||||
|
@ -435,11 +435,10 @@ SCM_DEFINE (scm_string_drop, "string-drop", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_string_drop
|
#define FUNC_NAME s_scm_string_drop
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cn;
|
size_t cn;
|
||||||
|
|
||||||
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
||||||
SCM_VALIDATE_INUM_COPY (2, n, cn);
|
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
|
||||||
SCM_ASSERT_RANGE (2, n, cn >= 0 && cn <= SCM_STRING_LENGTH (s));
|
|
||||||
|
|
||||||
return scm_mem2string (cstr + cn, SCM_STRING_LENGTH (s) - cn);
|
return scm_mem2string (cstr + cn, SCM_STRING_LENGTH (s) - cn);
|
||||||
}
|
}
|
||||||
|
@ -452,11 +451,10 @@ SCM_DEFINE (scm_string_take_right, "string-take-right", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_string_take_right
|
#define FUNC_NAME s_scm_string_take_right
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cn;
|
size_t cn;
|
||||||
|
|
||||||
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
||||||
SCM_VALIDATE_INUM_COPY (2, n, cn);
|
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
|
||||||
SCM_ASSERT_RANGE (2, n, cn >= 0 && cn <= SCM_STRING_LENGTH (s));
|
|
||||||
|
|
||||||
return scm_mem2string (cstr + SCM_STRING_LENGTH (s) - cn, cn);
|
return scm_mem2string (cstr + SCM_STRING_LENGTH (s) - cn, cn);
|
||||||
}
|
}
|
||||||
|
@ -469,11 +467,10 @@ SCM_DEFINE (scm_string_drop_right, "string-drop-right", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_string_drop_right
|
#define FUNC_NAME s_scm_string_drop_right
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cn;
|
size_t cn;
|
||||||
|
|
||||||
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
SCM_VALIDATE_STRING_COPY (1, s, cstr);
|
||||||
SCM_VALIDATE_INUM_COPY (2, n, cn);
|
cn = scm_to_unsigned_integer (n, 0, SCM_STRING_LENGTH (s));
|
||||||
SCM_ASSERT_RANGE (2, n, cn >= 0 && cn <= SCM_STRING_LENGTH (s));
|
|
||||||
|
|
||||||
return scm_mem2string (cstr, SCM_STRING_LENGTH (s) - cn);
|
return scm_mem2string (cstr, SCM_STRING_LENGTH (s) - cn);
|
||||||
}
|
}
|
||||||
|
@ -490,13 +487,14 @@ SCM_DEFINE (scm_string_pad, "string-pad", 2, 3, 0,
|
||||||
{
|
{
|
||||||
char cchr;
|
char cchr;
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cstart, cend, clen;
|
size_t cstart, cend, clen;
|
||||||
SCM result;
|
SCM result;
|
||||||
|
|
||||||
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
|
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
|
||||||
4, start, cstart,
|
4, start, cstart,
|
||||||
5, end, cend);
|
5, end, cend);
|
||||||
SCM_VALIDATE_INUM_COPY (2, len, clen);
|
clen = scm_to_size_t (len);
|
||||||
|
|
||||||
if (SCM_UNBNDP (chr))
|
if (SCM_UNBNDP (chr))
|
||||||
cchr = ' ';
|
cchr = ' ';
|
||||||
else
|
else
|
||||||
|
@ -532,13 +530,14 @@ SCM_DEFINE (scm_string_pad_right, "string-pad-right", 2, 3, 0,
|
||||||
{
|
{
|
||||||
char cchr;
|
char cchr;
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cstart, cend, clen;
|
size_t cstart, cend, clen;
|
||||||
SCM result;
|
SCM result;
|
||||||
|
|
||||||
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
|
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
|
||||||
4, start, cstart,
|
4, start, cstart,
|
||||||
5, end, cend);
|
5, end, cend);
|
||||||
SCM_VALIDATE_INUM_COPY (2, len, clen);
|
clen = scm_to_size_t (len);
|
||||||
|
|
||||||
if (SCM_UNBNDP (chr))
|
if (SCM_UNBNDP (chr))
|
||||||
cchr = ' ';
|
cchr = ' ';
|
||||||
else
|
else
|
||||||
|
@ -584,7 +583,7 @@ SCM_DEFINE (scm_string_trim, "string-trim", 1, 3, 0,
|
||||||
#define FUNC_NAME s_scm_string_trim
|
#define FUNC_NAME s_scm_string_trim
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cstart, cend;
|
size_t cstart, cend;
|
||||||
|
|
||||||
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
|
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
|
||||||
3, start, cstart,
|
3, start, cstart,
|
||||||
|
@ -2281,9 +2280,9 @@ SCM_DEFINE (scm_string_concatenate_reverse, "string-concatenate-reverse", 1, 2,
|
||||||
{
|
{
|
||||||
long strings;
|
long strings;
|
||||||
SCM tmp, result;
|
SCM tmp, result;
|
||||||
int len = 0;
|
size_t len = 0;
|
||||||
char * p;
|
char * p;
|
||||||
int cend = 0;
|
size_t cend = 0;
|
||||||
|
|
||||||
/* Check the optional arguments and calculate the additional length
|
/* Check the optional arguments and calculate the additional length
|
||||||
of the result string. */
|
of the result string. */
|
||||||
|
@ -2292,10 +2291,8 @@ SCM_DEFINE (scm_string_concatenate_reverse, "string-concatenate-reverse", 1, 2,
|
||||||
SCM_VALIDATE_STRING (2, final_string);
|
SCM_VALIDATE_STRING (2, final_string);
|
||||||
if (!SCM_UNBNDP (end))
|
if (!SCM_UNBNDP (end))
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_INUM_COPY (3, end, cend);
|
cend = scm_to_unsigned_integer (end,
|
||||||
SCM_ASSERT_RANGE (3, end,
|
0, SCM_STRING_LENGTH (final_string));
|
||||||
(cend >= 0) &&
|
|
||||||
(cend <= SCM_STRING_LENGTH (final_string)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2674,14 +2671,17 @@ SCM_DEFINE (scm_xsubstring, "xsubstring", 2, 3, 0,
|
||||||
#define FUNC_NAME s_scm_xsubstring
|
#define FUNC_NAME s_scm_xsubstring
|
||||||
{
|
{
|
||||||
char * cs, * p;
|
char * cs, * p;
|
||||||
int cstart, cend, cfrom, cto;
|
size_t cstart, cend, cfrom, cto;
|
||||||
SCM result;
|
SCM result;
|
||||||
|
|
||||||
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cs,
|
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cs,
|
||||||
4, start, cstart,
|
4, start, cstart,
|
||||||
5, end, cend);
|
5, end, cend);
|
||||||
SCM_VALIDATE_INUM_COPY (2, from, cfrom);
|
cfrom = scm_to_size_t (from);
|
||||||
SCM_VALIDATE_INUM_DEF_COPY (3, to, cfrom + (cend - cstart), cto);
|
if (SCM_UNBNDP (to))
|
||||||
|
cto = cfrom + (cend - cstart);
|
||||||
|
else
|
||||||
|
cto = scm_to_size_t (to);
|
||||||
if (cstart == cend && cfrom != cto)
|
if (cstart == cend && cfrom != cto)
|
||||||
SCM_MISC_ERROR ("start and end indices must not be equal", SCM_EOL);
|
SCM_MISC_ERROR ("start and end indices must not be equal", SCM_EOL);
|
||||||
|
|
||||||
|
@ -2713,7 +2713,7 @@ SCM_DEFINE (scm_string_xcopy_x, "string-xcopy!", 4, 3, 0,
|
||||||
#define FUNC_NAME s_scm_string_xcopy_x
|
#define FUNC_NAME s_scm_string_xcopy_x
|
||||||
{
|
{
|
||||||
char * ctarget, * cs, * p;
|
char * ctarget, * cs, * p;
|
||||||
int ctstart, csfrom, csto, cstart, cend;
|
size_t ctstart, csfrom, csto, cstart, cend;
|
||||||
SCM dummy = SCM_UNDEFINED;
|
SCM dummy = SCM_UNDEFINED;
|
||||||
int cdummy;
|
int cdummy;
|
||||||
|
|
||||||
|
@ -2723,8 +2723,11 @@ SCM_DEFINE (scm_string_xcopy_x, "string-xcopy!", 4, 3, 0,
|
||||||
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cs,
|
SCM_VALIDATE_SUBSTRING_SPEC_COPY (3, s, cs,
|
||||||
6, start, cstart,
|
6, start, cstart,
|
||||||
7, end, cend);
|
7, end, cend);
|
||||||
SCM_VALIDATE_INUM_COPY (4, sfrom, csfrom);
|
csfrom = scm_to_size_t (sfrom);
|
||||||
SCM_VALIDATE_INUM_DEF_COPY (5, sto, csfrom + (cend - cstart), csto);
|
if (SCM_UNBNDP (sto))
|
||||||
|
csto = csfrom + (cend - cstart);
|
||||||
|
else
|
||||||
|
csto = scm_to_size_t (sto);
|
||||||
if (cstart == cend && csfrom != csto)
|
if (cstart == cend && csfrom != csto)
|
||||||
SCM_MISC_ERROR ("start and end indices must not be equal", SCM_EOL);
|
SCM_MISC_ERROR ("start and end indices must not be equal", SCM_EOL);
|
||||||
SCM_ASSERT_RANGE (1, tstart,
|
SCM_ASSERT_RANGE (1, tstart,
|
||||||
|
@ -2754,7 +2757,7 @@ SCM_DEFINE (scm_string_replace, "string-replace", 2, 4, 0,
|
||||||
#define FUNC_NAME s_scm_string_replace
|
#define FUNC_NAME s_scm_string_replace
|
||||||
{
|
{
|
||||||
char * cstr1, * cstr2, * p;
|
char * cstr1, * cstr2, * p;
|
||||||
int cstart1, cend1, cstart2, cend2;
|
size_t cstart1, cend1, cstart2, cend2;
|
||||||
SCM result;
|
SCM result;
|
||||||
|
|
||||||
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
|
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s1, cstr1,
|
||||||
|
@ -2788,7 +2791,7 @@ SCM_DEFINE (scm_string_tokenize, "string-tokenize", 1, 3, 0,
|
||||||
#define FUNC_NAME s_scm_string_tokenize
|
#define FUNC_NAME s_scm_string_tokenize
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cstart, cend;
|
size_t cstart, cend;
|
||||||
SCM result = SCM_EOL;
|
SCM result = SCM_EOL;
|
||||||
|
|
||||||
static SCM charset_graphic = SCM_BOOL_F;
|
static SCM charset_graphic = SCM_BOOL_F;
|
||||||
|
@ -2850,7 +2853,7 @@ SCM_DEFINE (scm_string_filter, "string-filter", 2, 2, 0,
|
||||||
#define FUNC_NAME s_scm_string_filter
|
#define FUNC_NAME s_scm_string_filter
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cstart, cend;
|
size_t cstart, cend;
|
||||||
SCM result;
|
SCM result;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
|
@ -2916,7 +2919,7 @@ SCM_DEFINE (scm_string_delete, "string-delete", 2, 2, 0,
|
||||||
#define FUNC_NAME s_scm_string_delete
|
#define FUNC_NAME s_scm_string_delete
|
||||||
{
|
{
|
||||||
char * cstr;
|
char * cstr;
|
||||||
int cstart, cend;
|
size_t cstart, cend;
|
||||||
SCM result;
|
SCM result;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,8 @@ SCM_DEFINE (scm_char_set_hash, "char-set-hash", 1, 1, 0,
|
||||||
"returned value to the range 0 @dots{} @var{bound - 1}.")
|
"returned value to the range 0 @dots{} @var{bound - 1}.")
|
||||||
#define FUNC_NAME s_scm_char_set_hash
|
#define FUNC_NAME s_scm_char_set_hash
|
||||||
{
|
{
|
||||||
const int default_bnd = 871;
|
const unsigned long default_bnd = 871;
|
||||||
int bnd;
|
unsigned long bnd;
|
||||||
long * p;
|
long * p;
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
int k;
|
int k;
|
||||||
|
@ -175,7 +175,7 @@ SCM_DEFINE (scm_char_set_hash, "char-set-hash", 1, 1, 0,
|
||||||
bnd = default_bnd;
|
bnd = default_bnd;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_INUM_MIN_COPY (2, bound, 0, bnd);
|
bnd = scm_to_ulong (bound);
|
||||||
if (bnd == 0)
|
if (bnd == 0)
|
||||||
bnd = default_bnd;
|
bnd = default_bnd;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ SCM_DEFINE (scm_char_set_hash, "char-set-hash", 1, 1, 0,
|
||||||
if (p[k] != 0)
|
if (p[k] != 0)
|
||||||
val = p[k] + (val << 1);
|
val = p[k] + (val << 1);
|
||||||
}
|
}
|
||||||
return SCM_I_MAKINUM (val % bnd);
|
return scm_from_ulong (val % bnd);
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
@ -216,10 +216,8 @@ SCM_DEFINE (scm_char_set_ref, "char-set-ref", 2, 0, 0,
|
||||||
"pass a cursor for which @code{end-of-char-set?} returns true.")
|
"pass a cursor for which @code{end-of-char-set?} returns true.")
|
||||||
#define FUNC_NAME s_scm_char_set_ref
|
#define FUNC_NAME s_scm_char_set_ref
|
||||||
{
|
{
|
||||||
int ccursor;
|
size_t ccursor = scm_to_size_t (cursor);
|
||||||
|
|
||||||
SCM_VALIDATE_SMOB (1, cs, charset);
|
SCM_VALIDATE_SMOB (1, cs, charset);
|
||||||
SCM_VALIDATE_INUM_MIN_COPY (2, cursor, 0, ccursor);
|
|
||||||
|
|
||||||
if (ccursor >= SCM_CHARSET_SIZE || !SCM_CHARSET_GET (cs, ccursor))
|
if (ccursor >= SCM_CHARSET_SIZE || !SCM_CHARSET_GET (cs, ccursor))
|
||||||
SCM_MISC_ERROR ("invalid character set cursor: ~A", scm_list_1 (cursor));
|
SCM_MISC_ERROR ("invalid character set cursor: ~A", scm_list_1 (cursor));
|
||||||
|
@ -235,10 +233,8 @@ SCM_DEFINE (scm_char_set_cursor_next, "char-set-cursor-next", 2, 0, 0,
|
||||||
"cursor given satisfies @code{end-of-char-set?}.")
|
"cursor given satisfies @code{end-of-char-set?}.")
|
||||||
#define FUNC_NAME s_scm_char_set_cursor_next
|
#define FUNC_NAME s_scm_char_set_cursor_next
|
||||||
{
|
{
|
||||||
int ccursor;
|
size_t ccursor = scm_to_size_t (cursor);
|
||||||
|
|
||||||
SCM_VALIDATE_SMOB (1, cs, charset);
|
SCM_VALIDATE_SMOB (1, cs, charset);
|
||||||
SCM_VALIDATE_INUM_MIN_COPY (2, cursor, 0, ccursor);
|
|
||||||
|
|
||||||
if (ccursor >= SCM_CHARSET_SIZE || !SCM_CHARSET_GET (cs, ccursor))
|
if (ccursor >= SCM_CHARSET_SIZE || !SCM_CHARSET_GET (cs, ccursor))
|
||||||
SCM_MISC_ERROR ("invalid character set cursor: ~A", scm_list_1 (cursor));
|
SCM_MISC_ERROR ("invalid character set cursor: ~A", scm_list_1 (cursor));
|
||||||
|
@ -258,9 +254,7 @@ SCM_DEFINE (scm_end_of_char_set_p, "end-of-char-set?", 1, 0, 0,
|
||||||
"character set, @code{#f} otherwise.")
|
"character set, @code{#f} otherwise.")
|
||||||
#define FUNC_NAME s_scm_end_of_char_set_p
|
#define FUNC_NAME s_scm_end_of_char_set_p
|
||||||
{
|
{
|
||||||
int ccursor;
|
size_t ccursor = scm_to_size_t (cursor);
|
||||||
|
|
||||||
SCM_VALIDATE_INUM_MIN_COPY (1, cursor, 0, ccursor);
|
|
||||||
return scm_from_bool (ccursor >= SCM_CHARSET_SIZE);
|
return scm_from_bool (ccursor >= SCM_CHARSET_SIZE);
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
@ -661,13 +655,12 @@ SCM_DEFINE (scm_ucs_range_to_char_set, "ucs-range->char-set", 2, 2, 0,
|
||||||
#define FUNC_NAME s_scm_ucs_range_to_char_set
|
#define FUNC_NAME s_scm_ucs_range_to_char_set
|
||||||
{
|
{
|
||||||
SCM cs;
|
SCM cs;
|
||||||
int clower, cupper;
|
size_t clower, cupper;
|
||||||
long * p;
|
long * p;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM_COPY (1, lower, clower);
|
clower = scm_to_size_t (lower);
|
||||||
SCM_VALIDATE_INUM_COPY (2, upper, cupper);
|
cupper = scm_to_size_t (upper);
|
||||||
SCM_ASSERT_RANGE (1, lower, clower >= 0);
|
SCM_ASSERT_RANGE (2, upper, cupper >= clower);
|
||||||
SCM_ASSERT_RANGE (2, upper, cupper >= 0 && cupper >= clower);
|
|
||||||
if (!SCM_UNBNDP (error))
|
if (!SCM_UNBNDP (error))
|
||||||
{
|
{
|
||||||
if (scm_is_true (error))
|
if (scm_is_true (error))
|
||||||
|
@ -714,13 +707,12 @@ SCM_DEFINE (scm_ucs_range_to_char_set_x, "ucs-range->char-set!", 4, 0, 0,
|
||||||
"returned.")
|
"returned.")
|
||||||
#define FUNC_NAME s_scm_ucs_range_to_char_set_x
|
#define FUNC_NAME s_scm_ucs_range_to_char_set_x
|
||||||
{
|
{
|
||||||
int clower, cupper;
|
size_t clower, cupper;
|
||||||
long * p;
|
long * p;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM_COPY (1, lower, clower);
|
clower = scm_to_size_t (lower);
|
||||||
SCM_VALIDATE_INUM_COPY (2, upper, cupper);
|
cupper = scm_to_size_t (upper);
|
||||||
SCM_ASSERT_RANGE (1, lower, clower >= 0);
|
SCM_ASSERT_RANGE (2, upper, cupper >= clower);
|
||||||
SCM_ASSERT_RANGE (2, upper, cupper >= 0 && cupper >= clower);
|
|
||||||
if (scm_is_true (error))
|
if (scm_is_true (error))
|
||||||
{
|
{
|
||||||
SCM_ASSERT_RANGE (1, lower, clower <= SCM_CHARSET_SIZE);
|
SCM_ASSERT_RANGE (1, lower, clower <= SCM_CHARSET_SIZE);
|
||||||
|
|
|
@ -286,7 +286,7 @@ SCM_DEFINE (scm_u8vector_p, "u8vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_u8vector, "make-u8vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_u8vector, "make-u8vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -296,10 +296,9 @@ SCM_DEFINE (scm_make_u8vector, "make-u8vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_u8 * p;
|
int_u8 * p;
|
||||||
int_u8 f;
|
int_u8 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U8, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U8, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -472,7 +471,7 @@ SCM_DEFINE (scm_s8vector_p, "s8vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_s8vector, "make-s8vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_s8vector, "make-s8vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -482,10 +481,9 @@ SCM_DEFINE (scm_make_s8vector, "make-s8vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_s8 * p;
|
int_s8 * p;
|
||||||
int_s8 f;
|
int_s8 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S8, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S8, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -660,7 +658,7 @@ SCM_DEFINE (scm_u16vector_p, "u16vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_u16vector, "make-u16vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_u16vector, "make-u16vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -670,10 +668,9 @@ SCM_DEFINE (scm_make_u16vector, "make-u16vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_u16 * p;
|
int_u16 * p;
|
||||||
int_u16 f;
|
int_u16 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U16, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U16, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -830,7 +827,7 @@ SCM_DEFINE (scm_s16vector_p, "s16vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_s16vector, "make-s16vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_s16vector, "make-s16vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -840,10 +837,9 @@ SCM_DEFINE (scm_make_s16vector, "make-s16vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_s16 * p;
|
int_s16 * p;
|
||||||
int_s16 f;
|
int_s16 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S16, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S16, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -1003,7 +999,7 @@ SCM_DEFINE (scm_u32vector_p, "u32vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_u32vector, "make-u32vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_u32vector, "make-u32vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -1013,10 +1009,9 @@ SCM_DEFINE (scm_make_u32vector, "make-u32vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_u32 * p;
|
int_u32 * p;
|
||||||
int_u32 f;
|
int_u32 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U32, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U32, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -1174,7 +1169,7 @@ SCM_DEFINE (scm_s32vector_p, "s32vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_s32vector, "make-s32vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_s32vector, "make-s32vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -1184,10 +1179,9 @@ SCM_DEFINE (scm_make_s32vector, "make-s32vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_s32 * p;
|
int_s32 * p;
|
||||||
int_s32 f;
|
int_s32 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S32, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S32, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -1347,7 +1341,7 @@ SCM_DEFINE (scm_u64vector_p, "u64vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_u64vector, "make-u64vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_u64vector, "make-u64vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -1357,10 +1351,9 @@ SCM_DEFINE (scm_make_u64vector, "make-u64vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_u64 * p;
|
int_u64 * p;
|
||||||
int_u64 f;
|
int_u64 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U64, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_U64, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -1518,7 +1511,7 @@ SCM_DEFINE (scm_s64vector_p, "s64vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_s64vector, "make-s64vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_s64vector, "make-s64vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -1528,10 +1521,9 @@ SCM_DEFINE (scm_make_s64vector, "make-s64vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
int_s64 * p;
|
int_s64 * p;
|
||||||
int_s64 f;
|
int_s64 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S64, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_S64, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -1691,7 +1683,7 @@ SCM_DEFINE (scm_f32vector_p, "f32vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_f32vector, "make-f32vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_f32vector, "make-f32vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -1701,10 +1693,9 @@ SCM_DEFINE (scm_make_f32vector, "make-f32vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
float_f32 * p;
|
float_f32 * p;
|
||||||
float_f32 f;
|
float_f32 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_F32, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_F32, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
@ -1887,7 +1878,7 @@ SCM_DEFINE (scm_f64vector_p, "f64vector?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_f64vector, "make-f64vector", 1, 1, 0,
|
SCM_DEFINE (scm_make_f64vector, "make-f64vector", 1, 1, 0,
|
||||||
(SCM n, SCM fill),
|
(SCM len, SCM fill),
|
||||||
"Create a newly allocated homogeneous numeric vector which can\n"
|
"Create a newly allocated homogeneous numeric vector which can\n"
|
||||||
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
"hold @var{len} elements. If @var{fill} is given, it is used to\n"
|
||||||
"initialize the elements, otherwise the contents of the vector\n"
|
"initialize the elements, otherwise the contents of the vector\n"
|
||||||
|
@ -1897,10 +1888,9 @@ SCM_DEFINE (scm_make_f64vector, "make-f64vector", 1, 1, 0,
|
||||||
SCM uvec;
|
SCM uvec;
|
||||||
float_f64 * p;
|
float_f64 * p;
|
||||||
float_f64 f;
|
float_f64 f;
|
||||||
int count;
|
size_t count;
|
||||||
|
|
||||||
SCM_VALIDATE_INUM (1, n);
|
count = scm_to_size_t (len);
|
||||||
count = SCM_INUM (n);
|
|
||||||
uvec = make_uvec (FUNC_NAME, SCM_UVEC_F64, count);
|
uvec = make_uvec (FUNC_NAME, SCM_UVEC_F64, count);
|
||||||
if (SCM_UNBNDP (fill))
|
if (SCM_UNBNDP (fill))
|
||||||
f = 0;
|
f = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue