1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

* srfi-14.c (s_scm_char_set_eq): bug fix: (char-set=) should

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.
This commit is contained in:
Gary Houston 2001-07-11 20:49:05 +00:00
parent acc787751b
commit 2545bd29ee
3 changed files with 24 additions and 21 deletions

View file

@ -1,3 +1,11 @@
2001-07-11 Gary Houston <ghouston@arglist.com>
* srfi-14.c (s_scm_char_set_eq): bug fix: (char-set=) should
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.
2001-07-09 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* README: Cleanup.

View file

@ -111,33 +111,28 @@ SCM_DEFINE (scm_char_set_p, "char-set?", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE (scm_char_set_eq, "char-set=", 1, 0, 1,
(SCM cs1, SCM csr),
SCM_DEFINE (scm_char_set_eq, "char-set=", 0, 0, 1,
(SCM char_sets),
"Return @code{#t} if all given character sets are equal.")
#define FUNC_NAME s_scm_char_set_eq
{
int argnum = 2;
int argnum = 1;
long *cs1_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 csn = SCM_CAR (char_sets);
long *csn_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++)
{
if (p1[k] != p2[k])
return SCM_BOOL_F;
}
csr = SCM_CDR (csr);
cs1 = cs2;
SCM_VALIDATE_SMOB (argnum++, csn, charset);
csn_data = (long *) SCM_SMOB_DATA (csn);
if (cs1_data == NULL)
cs1_data = csn_data;
else if (memcmp (cs1_data, csn_data, SCM_CHARSET_SIZE) != 0)
return SCM_BOOL_F;
char_sets = SCM_CDR (char_sets);
}
return SCM_BOOL_T;
}

View file

@ -60,7 +60,7 @@ void scm_c_init_srfi_14 (void);
void scm_init_srfi_14 (void);
SCM scm_char_set_p (SCM obj);
SCM scm_char_set_eq (SCM cs1, SCM csr);
SCM scm_char_set_eq (SCM char_sets);
SCM scm_char_set_leq (SCM cs1, SCM csr);
SCM scm_char_set_hash (SCM cs, SCM bound);
SCM scm_char_set_cursor (SCM cs);