summaryrefslogtreecommitdiff
path: root/srfi
diff options
context:
space:
mode:
authorGary Houston <ghouston@arglist.com>2001-07-11 22:00:52 +0000
committerGary Houston <ghouston@arglist.com>2001-07-11 22:00:52 +0000
commitbe390de2baddbe5361bfc99da3f402b1e8d19225 (patch)
tree4a25c165b4a46f1e19b8e3c7538f8a0f0502fb97 /srfi
parentdd84cd4d1fd4f216b9c473c37eeeef790867c925 (diff)
downloadguile-be390de2baddbe5361bfc99da3f402b1e8d19225.tar.gz
(s_scm_char_set_leq): similarly, (char-set<=) should return #t.
take a single "rest" argument.
Diffstat (limited to 'srfi')
-rw-r--r--srfi/ChangeLog4
-rw-r--r--srfi/srfi-14.c50
-rw-r--r--srfi/srfi-14.h2
3 files changed, 30 insertions, 26 deletions
diff --git a/srfi/ChangeLog b/srfi/ChangeLog
index f9e8287d5..dc6ee8cf0 100644
--- a/srfi/ChangeLog
+++ b/srfi/ChangeLog
@@ -4,7 +4,9 @@
return #t instead of giving wrong-number-of-arguments . take a
single "rest" argument. use memcmp instead of a loop to compare
the values.
- srfi-14.h: update the declaration.
+ (s_scm_char_set_leq): similarly, (char-set<=) should return #t.
+ take a single "rest" argument.
+ srfi-14.h: update the declarations.
2001-07-09 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
diff --git a/srfi/srfi-14.c b/srfi/srfi-14.c
index a0fc6615a..b18cb1251 100644
--- a/srfi/srfi-14.c
+++ b/srfi/srfi-14.c
@@ -123,14 +123,14 @@ SCM_DEFINE (scm_char_set_eq, "char-set=", 0, 0, 1,
while (!SCM_NULLP (char_sets))
{
- SCM csn = SCM_CAR (char_sets);
- long *csn_data;
+ SCM csi = SCM_CAR (char_sets);
+ long *csi_data;
- SCM_VALIDATE_SMOB (argnum++, csn, charset);
- csn_data = (long *) SCM_SMOB_DATA (csn);
+ SCM_VALIDATE_SMOB (argnum++, csi, charset);
+ csi_data = (long *) SCM_SMOB_DATA (csi);
if (cs1_data == NULL)
- cs1_data = csn_data;
- else if (memcmp (cs1_data, csn_data, SCM_CHARSET_SIZE) != 0)
+ cs1_data = csi_data;
+ else if (memcmp (cs1_data, csi_data, SCM_CHARSET_SIZE) != 0)
return SCM_BOOL_F;
char_sets = SCM_CDR (char_sets);
}
@@ -139,34 +139,36 @@ SCM_DEFINE (scm_char_set_eq, "char-set=", 0, 0, 1,
#undef FUNC_NAME
-SCM_DEFINE (scm_char_set_leq, "char-set<=", 1, 0, 1,
- (SCM cs1, SCM csr),
+SCM_DEFINE (scm_char_set_leq, "char-set<=", 0, 0, 1,
+ (SCM char_sets),
"Return @code{#t} if every character set @var{cs}i is a subset\n"
"of character set @var{cs}i+1.")
#define FUNC_NAME s_scm_char_set_leq
{
- int argnum = 2;
+ int argnum = 1;
+ long *prev_data = NULL;
- SCM_VALIDATE_SMOB (1, cs1, charset);
- SCM_VALIDATE_REST_ARGUMENT (csr);
+ SCM_VALIDATE_REST_ARGUMENT (char_sets);
- while (!SCM_NULLP (csr))
+ while (!SCM_NULLP (char_sets))
{
- long * p1, * p2;
- SCM cs2 = SCM_CAR (csr);
- int k;
+ SCM csi = SCM_CAR (char_sets);
+ long *csi_data;
- SCM_VALIDATE_SMOB (argnum++, cs2, charset);
- p1 = (long *) SCM_SMOB_DATA (cs1);
- p2 = (long *) SCM_SMOB_DATA (cs2);
- for (k = 0; k < SCM_CHARSET_SIZE / sizeof (long); k++)
+ SCM_VALIDATE_SMOB (argnum++, csi, charset);
+ csi_data = (long *) SCM_SMOB_DATA (csi);
+ if (prev_data)
{
- if ((p1[k] & p2[k]) != p1[k])
- return SCM_BOOL_F;
+ int k;
+
+ for (k = 0; k < SCM_CHARSET_SIZE / sizeof (long); k++)
+ {
+ if ((prev_data[k] & csi_data[k]) != prev_data[k])
+ return SCM_BOOL_F;
+ }
}
-
- csr = SCM_CDR (csr);
- cs1 = cs2;
+ prev_data = csi_data;
+ char_sets = SCM_CDR (char_sets);
}
return SCM_BOOL_T;
}
diff --git a/srfi/srfi-14.h b/srfi/srfi-14.h
index 2ddc9c83c..40b355236 100644
--- a/srfi/srfi-14.h
+++ b/srfi/srfi-14.h
@@ -61,7 +61,7 @@ void scm_init_srfi_14 (void);
SCM scm_char_set_p (SCM obj);
SCM scm_char_set_eq (SCM char_sets);
-SCM scm_char_set_leq (SCM cs1, SCM csr);
+SCM scm_char_set_leq (SCM char_sets);
SCM scm_char_set_hash (SCM cs, SCM bound);
SCM scm_char_set_cursor (SCM cs);
SCM scm_char_set_ref (SCM cs, SCM cursor);