[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
guile/guile-core/libguile ChangeLog strorder.c
From: |
Dirk Herrmann |
Subject: |
guile/guile-core/libguile ChangeLog strorder.c |
Date: |
Wed, 24 Jan 2001 10:07:30 -0800 |
CVSROOT: /cvs
Module name: guile
Changes by: Dirk Herrmann <address@hidden> 01/01/24 10:07:29
Modified files:
guile-core/libguile: ChangeLog strorder.c
Log message:
* Make sure that parameter errors are reported correctly.
Thanks to Martin Grabmueller for sending this patch.
CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1244&r2=1.1245
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/strorder.c.diff?r1=1.20&r2=1.21
Patches:
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1244
guile/guile-core/libguile/ChangeLog:1.1245
--- guile/guile-core/libguile/ChangeLog:1.1244 Wed Jan 24 08:06:20 2001
+++ guile/guile-core/libguile/ChangeLog Wed Jan 24 10:07:29 2001
@@ -1,5 +1,25 @@
2001-01-24 Dirk Herrmann <address@hidden>
+ 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 <address@hidden>
+
This patch modifies scm_display_error to perform parameter
checking. Thanks to Neil Jerram for the bug report.
Index: guile/guile-core/libguile/strorder.c
diff -u guile/guile-core/libguile/strorder.c:1.20
guile/guile-core/libguile/strorder.c:1.21
--- guile/guile-core/libguile/strorder.c:1.20 Wed Nov 22 03:20:03 2000
+++ guile/guile-core/libguile/strorder.c Wed Jan 24 10:07:29 2001
@@ -124,18 +124,14 @@
#undef FUNC_NAME
-SCM_DEFINE1 (scm_string_less_p, "string<?", scm_tc7_rpsubr,
- (SCM s1, SCM s2),
- "Lexicographic ordering predicate; returns @t{#t} if @var{s1}\n"
- "is lexicographically less than @var{s2}. (r5rs)")
-#define FUNC_NAME s_scm_string_less_p
+/* Helper function for the lexicographic ordering predicates.
+ * No argument checking is performed. */
+static SCM
+string_less_p (SCM s1, SCM s2)
{
scm_sizet i, length1, length2, lengthm;
unsigned char *c1, *c2;
- SCM_VALIDATE_STRING (1, s1);
- SCM_VALIDATE_STRING (2, s2);
-
length1 = SCM_STRING_LENGTH (s1);
length2 = SCM_STRING_LENGTH (s2);
lengthm = min (length1, length2);
@@ -150,6 +146,19 @@
return SCM_BOOL (length1 < length2);
}
+
+
+SCM_DEFINE1 (scm_string_less_p, "string<?", scm_tc7_rpsubr,
+ (SCM s1, SCM s2),
+ "Lexicographic ordering predicate; returns @t{#t} if @var{s1}\n"
+ "is lexicographically less than @var{s2}. (r5rs)")
+#define FUNC_NAME s_scm_string_less_p
+{
+ SCM_VALIDATE_STRING (1, s1);
+ SCM_VALIDATE_STRING (2, s2);
+
+ return string_less_p (s1, s2);
+}
#undef FUNC_NAME
@@ -159,7 +168,10 @@
"is lexicographically less than or equal to @var{s2}. (r5rs)")
#define FUNC_NAME s_scm_string_leq_p
{
- return SCM_BOOL_NOT (scm_string_less_p (s2, s1));
+ SCM_VALIDATE_STRING (1, s1);
+ SCM_VALIDATE_STRING (2, s2);
+
+ return SCM_BOOL_NOT (string_less_p (s2, s1));
}
#undef FUNC_NAME
@@ -170,7 +182,10 @@
"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 @@
"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,
- (SCM s1, SCM s2),
- "Case insensitive lexicographic ordering predicate; \n"
- "returns @t{#t} if @var{s1} is lexicographically less than\n"
- "@var{s2} regardless of case. (r5rs)")
-#define FUNC_NAME s_scm_string_ci_less_p
+/* Helper function for the case insensitive lexicographic ordering
+ * predicates. No argument checking is performed. */
+static SCM
+string_ci_less_p (SCM s1, SCM s2)
{
scm_sizet i, length1, length2, lengthm;
unsigned char *c1, *c2;
- SCM_VALIDATE_STRING (1, s1);
- SCM_VALIDATE_STRING (2, s2);
-
length1 = SCM_STRING_LENGTH (s1);
length2 = SCM_STRING_LENGTH (s2);
lengthm = min (length1, length2);
@@ -213,6 +226,20 @@
return SCM_BOOL (length1 < length2);
}
+
+
+SCM_DEFINE1 (scm_string_ci_less_p, "string-ci<?", scm_tc7_rpsubr,
+ (SCM s1, SCM s2),
+ "Case insensitive lexicographic ordering predicate; \n"
+ "returns @t{#t} if @var{s1} is lexicographically less than\n"
+ "@var{s2} regardless of case. (r5rs)")
+#define FUNC_NAME s_scm_string_ci_less_p
+{
+ SCM_VALIDATE_STRING (1, s1);
+ SCM_VALIDATE_STRING (2, s2);
+
+ return string_ci_less_p (s1, s2);
+}
#undef FUNC_NAME
@@ -223,7 +250,10 @@
"or equal to @var{s2} regardless of case. (r5rs)")
#define FUNC_NAME s_scm_string_ci_leq_p
{
- return SCM_BOOL_NOT (scm_string_ci_less_p (s2, s1));
+ SCM_VALIDATE_STRING (1, s1);
+ SCM_VALIDATE_STRING (2, s2);
+
+ return SCM_BOOL_NOT (string_ci_less_p (s2, s1));
}
#undef FUNC_NAME
@@ -235,7 +265,10 @@
"@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 @@
"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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- guile/guile-core/libguile ChangeLog strorder.c,
Dirk Herrmann <=