From a6ec2a3cefc8dcce1a6a6590f148973b29226426 Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sun, 22 Jul 2001 20:19:12 +0000 Subject: [PATCH] * 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. --- srfi/ChangeLog | 6 ++++ srfi/srfi-14.c | 76 +++++++++++++++++++++++++++++++------------------- srfi/srfi-14.h | 4 +-- 3 files changed, 56 insertions(+), 30 deletions(-) diff --git a/srfi/ChangeLog b/srfi/ChangeLog index 2646f5e25..e4a7440a8 100644 --- a/srfi/ChangeLog +++ b/srfi/ChangeLog @@ -1,3 +1,9 @@ +2001-07-22 Gary Houston + + * 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. + 2001-07-18 Martin Grabmueller * srfi-11.scm, srfi-8.scm: Update copyright notice. 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; } diff --git a/srfi/srfi-14.h b/srfi/srfi-14.h index 2621ba22f..02e74f765 100644 --- a/srfi/srfi-14.h +++ b/srfi/srfi-14.h @@ -102,9 +102,9 @@ SCM scm_char_set_adjoin_x (SCM cs, SCM rest); SCM scm_char_set_delete_x (SCM cs, SCM rest); SCM scm_char_set_complement (SCM cs); SCM scm_char_set_union (SCM rest); -SCM scm_char_set_intersection (SCM cs1, SCM rest); +SCM scm_char_set_intersection (SCM rest); SCM scm_char_set_difference (SCM cs1, SCM rest); -SCM scm_char_set_xor (SCM cs1, SCM rest); +SCM scm_char_set_xor (SCM rest); SCM scm_char_set_diff_plus_intersection (SCM cs1, SCM rest); SCM scm_char_set_complement_x (SCM cs); SCM scm_char_set_union_x (SCM cs1, SCM rest);