summaryrefslogtreecommitdiff
path: root/libguile/strop.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2004-07-23 15:43:02 +0000
committerMarius Vollmer <mvo@zagadka.de>2004-07-23 15:43:02 +0000
commite11e83f3d99305ada6354cae7123fb8c0e998703 (patch)
tree23dccd2a0fd1741abb8561214acadc347036480b /libguile/strop.c
parent928e0f421070bb610f3375d5808a6378d5edfa1b (diff)
downloadguile-e11e83f3d99305ada6354cae7123fb8c0e998703.tar.gz
* deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,
SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP and SCM_I_INUM, respectively and adding deprecated versions to deprecated.h and deprecated.c. Changed all uses to either use the SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
Diffstat (limited to 'libguile/strop.c')
-rw-r--r--libguile/strop.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/libguile/strop.c b/libguile/strop.c
index 415fd5068..0400870cc 100644
--- a/libguile/strop.c
+++ b/libguile/strop.c
@@ -61,27 +61,21 @@ scm_i_index (SCM *str, SCM chr, int direction, SCM sub_start,
SCM_ASSERT (SCM_CHARP (chr), chr, SCM_ARG2, why);
if (scm_is_false (sub_start))
- sub_start = SCM_I_MAKINUM (0);
-
- SCM_ASSERT (SCM_INUMP (sub_start), sub_start, SCM_ARG3, why);
- lower = SCM_INUM (sub_start);
- if (lower < 0 || lower > SCM_STRING_LENGTH (*str))
- scm_out_of_range (why, sub_start);
+ lower = 0;
+ else
+ lower = scm_to_signed_integer (sub_start, 0, SCM_STRING_LENGTH(*str));
if (scm_is_false (sub_end))
- sub_end = SCM_I_MAKINUM (SCM_STRING_LENGTH (*str));
-
- SCM_ASSERT (SCM_INUMP (sub_end), sub_end, SCM_ARG4, why);
- upper = SCM_INUM (sub_end);
- if (upper < SCM_INUM (sub_start) || upper > SCM_STRING_LENGTH (*str))
- scm_out_of_range (why, sub_end);
+ upper = SCM_STRING_LENGTH (*str);
+ else
+ upper = scm_to_signed_integer (sub_end, lower, SCM_STRING_LENGTH(*str));
if (direction > 0)
{
p = SCM_STRING_UCHARS (*str) + lower;
ch = SCM_CHAR (chr);
- for (x = SCM_INUM (sub_start); x < upper; ++x, ++p)
+ for (x = lower; x < upper; ++x, ++p)
if (*p == ch)
return x;
}
@@ -124,7 +118,7 @@ SCM_DEFINE (scm_string_index, "string-index", 2, 2, 0,
pos = scm_i_index (&str, chr, 1, frm, to, FUNC_NAME);
return (pos < 0
? SCM_BOOL_F
- : SCM_I_MAKINUM (pos));
+ : scm_from_long (pos));
}
#undef FUNC_NAME
@@ -154,7 +148,7 @@ SCM_DEFINE (scm_string_rindex, "string-rindex", 2, 2, 0,
pos = scm_i_index (&str, chr, -1, frm, to, FUNC_NAME);
return (pos < 0
? SCM_BOOL_F
- : SCM_I_MAKINUM (pos));
+ : scm_from_long (pos));
}
#undef FUNC_NAME