summaryrefslogtreecommitdiff
path: root/srfi/srfi-14.c
diff options
context:
space:
mode:
authorGary Houston <ghouston@arglist.com>2001-07-22 20:17:28 +0000
committerGary Houston <ghouston@arglist.com>2001-07-22 20:17:28 +0000
commitd1bc66027ef9081ab86bb7a1e5061700df022e87 (patch)
tree4291ef741bdabade9b16295c21ddc93c84ab4092 /srfi/srfi-14.c
parentf3805ebb7cd244512e9f1d05c46d45df653da633 (diff)
downloadguile-d1bc66027ef9081ab86bb7a1e5061700df022e87.tar.gz
* srfi-14.c (scm_char_set_intersection, scm_char_set_xor): remove
the compulsory cs1 arguments: all args are optional in final spec. * srfi-14.h: declarations updated.
Diffstat (limited to 'srfi/srfi-14.c')
-rw-r--r--srfi/srfi-14.c76
1 files changed, 48 insertions, 28 deletions
diff --git a/srfi/srfi-14.c b/srfi/srfi-14.c
index 7973e61d0..798f75bb5 100644
--- a/srfi/srfi-14.c
+++ b/srfi/srfi-14.c
@@ -1070,31 +1070,41 @@ SCM_DEFINE (scm_char_set_union, "char-set-union", 0, 0, 1,
#undef FUNC_NAME
-SCM_DEFINE (scm_char_set_intersection, "char-set-intersection", 1, 0, 1,
- (SCM cs1, SCM rest),
+SCM_DEFINE (scm_char_set_intersection, "char-set-intersection", 0, 0, 1,
+ (SCM rest),
"Return the intersection of all argument character sets.")
#define FUNC_NAME s_scm_char_set_intersection
{
- int c = 2;
SCM res;
- long * p;
- SCM_VALIDATE_SMOB (1, cs1, charset);
SCM_VALIDATE_REST_ARGUMENT (rest);
- res = scm_char_set_copy (cs1);
- p = (long *) SCM_SMOB_DATA (res);
- while (!SCM_NULLP (rest))
+ if (SCM_NULLP (rest))
+ res = make_char_set (FUNC_NAME);
+ else
{
- int k;
- SCM cs = SCM_CAR (rest);
- SCM_VALIDATE_SMOB (c, cs, charset);
- c++;
+ long *p;
+ int argnum = 2;
+
+ res = scm_char_set_copy (SCM_CAR (rest));
+ p = (long *) SCM_SMOB_DATA (res);
rest = SCM_CDR (rest);
- for (k = 0; k < LONGS_PER_CHARSET; k++)
- p[k] &= ((long *) SCM_SMOB_DATA (cs))[k];
+ while (SCM_CONSP (rest))
+ {
+ int k;
+ SCM cs = SCM_CAR (rest);
+ long *cs_data;
+
+ SCM_VALIDATE_SMOB (argnum, cs, charset);
+ argnum++;
+ cs_data = (long *) SCM_SMOB_DATA (cs);
+ rest = SCM_CDR (rest);
+ for (k = 0; k < LONGS_PER_CHARSET; k++)
+ p[k] &= cs_data[k];
+ }
}
+
return res;
}
#undef FUNC_NAME
@@ -1130,30 +1140,40 @@ SCM_DEFINE (scm_char_set_difference, "char-set-difference", 1, 0, 1,
#undef FUNC_NAME
-SCM_DEFINE (scm_char_set_xor, "char-set-xor", 1, 0, 1,
- (SCM cs1, SCM rest),
+SCM_DEFINE (scm_char_set_xor, "char-set-xor", 0, 0, 1,
+ (SCM rest),
"Return the exclusive-or of all argument character sets.")
#define FUNC_NAME s_scm_char_set_xor
{
- int c = 2;
SCM res;
- long * p;
- SCM_VALIDATE_SMOB (1, cs1, charset);
SCM_VALIDATE_REST_ARGUMENT (rest);
- res = scm_char_set_copy (cs1);
- p = (long *) SCM_SMOB_DATA (res);
- while (!SCM_NULLP (rest))
+ if (SCM_NULLP (rest))
+ res = make_char_set (FUNC_NAME);
+ else
{
- int k;
- SCM cs = SCM_CAR (rest);
- SCM_VALIDATE_SMOB (c, cs, charset);
- c++;
+ long * p;
+ int argnum = 2;
+
+ res = scm_char_set_copy (SCM_CAR (rest));
+ p = (long *) SCM_SMOB_DATA (res);
rest = SCM_CDR (rest);
- for (k = 0; k < LONGS_PER_CHARSET; k++)
- p[k] ^= ((long *) SCM_SMOB_DATA (cs))[k];
+ while (SCM_CONSP (rest))
+ {
+ int k;
+ SCM cs = SCM_CAR (rest);
+ long *cs_data;
+
+ SCM_VALIDATE_SMOB (argnum, cs, charset);
+ argnum++;
+ cs_data = (long *) SCM_SMOB_DATA (cs);
+ rest = SCM_CDR (rest);
+
+ for (k = 0; k < LONGS_PER_CHARSET; k++)
+ p[k] ^= cs_data[k];
+ }
}
return res;
}