From 3ba5a6c2f2be7ee559f336d96f923e490b4d145b Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Wed, 24 Jan 2001 18:07:29 +0000 Subject: [PATCH] * Make sure that parameter errors are reported correctly. Thanks to Martin Grabmueller for sending this patch. --- libguile/ChangeLog | 20 +++++++++++ libguile/strorder.c | 82 ++++++++++++++++++++++++++++++++------------- 2 files changed, 79 insertions(+), 23 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 3fa5ceda2..66e913e43 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,23 @@ +2001-01-24 Dirk Herrmann + + This patch was sent by Martin Grabmueller and makes sure that + parameter errors are reported correctly by the lexicographic + ordering predicates. + + * strorder.c (string_less_p, string_ci_less_p): New functions. + + (scm_string_less_p, scm_string_ci_less_p): Extracted the core + functionality into string_less_p, string_ci_less_p respectively. + The remaining code is just a wrapper to do the parameter + checking. + + (scm_string_leq_p, scm_string_gr_p, scm_string_geq_p): Check the + parameters and call string_less_p instead of scm_string_less_p. + + (scm_string_ci_leq_p, scm_string_ci_gr_p, scm_string_ci_geq_p): + Check the parameters and call string_less_ci_p instead of + scm_string_ci_less_p. + 2001-01-24 Dirk Herrmann This patch modifies scm_display_error to perform parameter diff --git a/libguile/strorder.c b/libguile/strorder.c index 815488a92..adea5de92 100644 --- a/libguile/strorder.c +++ b/libguile/strorder.c @@ -124,18 +124,14 @@ SCM_DEFINE1 (scm_string_ci_equal_p, "string-ci=?", scm_tc7_rpsubr, #undef FUNC_NAME -SCM_DEFINE1 (scm_string_less_p, "string?", scm_tc7_rpsubr, "is lexicographically greater than @var{s2}. (r5rs)") #define FUNC_NAME s_scm_string_gr_p { - return scm_string_less_p (s2, s1); + SCM_VALIDATE_STRING (1, s1); + SCM_VALIDATE_STRING (2, s2); + + return string_less_p (s2, s1); } #undef FUNC_NAME @@ -181,24 +196,22 @@ SCM_DEFINE1 (scm_string_geq_p, "string>=?", scm_tc7_rpsubr, "is lexicographically greater than or equal to @var{s2}. (r5rs)") #define FUNC_NAME s_scm_string_geq_p { - return SCM_BOOL_NOT (scm_string_less_p (s1, s2)); + SCM_VALIDATE_STRING (1, s1); + SCM_VALIDATE_STRING (2, s2); + + return SCM_BOOL_NOT (string_less_p (s1, s2)); } #undef FUNC_NAME -SCM_DEFINE1 (scm_string_ci_less_p, "string-ci?", scm_tc7_rpsubr, "@var{s2} regardless of case. (r5rs)") #define FUNC_NAME s_scm_string_ci_gr_p { - return scm_string_ci_less_p (s2, s1); + SCM_VALIDATE_STRING (1, s1); + SCM_VALIDATE_STRING (2, s2); + + return string_ci_less_p (s2, s1); } #undef FUNC_NAME @@ -247,7 +280,10 @@ SCM_DEFINE1 (scm_string_ci_geq_p, "string-ci>=?", scm_tc7_rpsubr, "or equal to @var{s2} regardless of case. (r5rs)") #define FUNC_NAME s_scm_string_ci_geq_p { - return SCM_BOOL_NOT (scm_string_ci_less_p (s1, s2)); + SCM_VALIDATE_STRING (1, s1); + SCM_VALIDATE_STRING (2, s2); + + return SCM_BOOL_NOT (string_ci_less_p (s1, s2)); } #undef FUNC_NAME