1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 23:00:22 +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> 2001-07-09 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* README: Cleanup. * README: Cleanup.

View file

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

View file

@ -60,7 +60,7 @@ void scm_c_init_srfi_14 (void);
void scm_init_srfi_14 (void); void scm_init_srfi_14 (void);
SCM scm_char_set_p (SCM obj); 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_leq (SCM cs1, SCM csr);
SCM scm_char_set_hash (SCM cs, SCM bound); SCM scm_char_set_hash (SCM cs, SCM bound);
SCM scm_char_set_cursor (SCM cs); SCM scm_char_set_cursor (SCM cs);