guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/srfi ChangeLog srfi-14.c


From: Gary Houston
Subject: guile/guile-core/srfi ChangeLog srfi-14.c
Date: Sun, 22 Jul 2001 15:01:50 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Gary Houston <address@hidden>   01/07/22 15:01:50

Modified files:
        guile-core/srfi: ChangeLog srfi-14.c 

Log message:
        (scm_char_set_xor): bug fix: characters should only be included if
        they occur in exactly one argument, but were included if they
        occured an odd number of times >= 3, e.g, in (char-set-xor a a a)
        where a is (char-set #\a).  fix it with a "mask" array.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/srfi/ChangeLog.diff?cvsroot=OldCVS&tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/srfi/srfi-14.c.diff?cvsroot=OldCVS&tr1=1.19&tr2=1.20&r1=text&r2=text

Patches:
Index: guile/guile-core/srfi/ChangeLog
diff -u guile/guile-core/srfi/ChangeLog:1.57 
guile/guile-core/srfi/ChangeLog:1.58
--- guile/guile-core/srfi/ChangeLog:1.57        Sun Jul 22 13:17:28 2001
+++ guile/guile-core/srfi/ChangeLog     Sun Jul 22 15:01:50 2001
@@ -2,6 +2,11 @@
 
        * srfi-14.c (scm_char_set_intersection, scm_char_set_xor): remove
        the compulsory cs1 arguments: all args are optional in final spec.
+       (scm_char_set_xor): bug fix: characters should only be included if
+       they occur in exactly one argument, but were included if they
+       occured an odd number of times >= 3, e.g, in (char-set-xor a a a)
+       where a is (char-set #\a).  fix it with a "mask" array.
+
        * srfi-14.h: declarations updated.
 
 2001-07-18  Martin Grabmueller  <address@hidden>
Index: guile/guile-core/srfi/srfi-14.c
diff -u guile/guile-core/srfi/srfi-14.c:1.19 
guile/guile-core/srfi/srfi-14.c:1.20
--- guile/guile-core/srfi/srfi-14.c:1.19        Sun Jul 22 13:17:28 2001
+++ guile/guile-core/srfi/srfi-14.c     Sun Jul 22 15:01:50 2001
@@ -1155,16 +1155,18 @@
     {
       long * p;
       int argnum = 2;
+      long mask[LONGS_PER_CHARSET];
+      int k;
 
+      memset (mask, 0, sizeof mask);
       res = scm_char_set_copy (SCM_CAR (rest));
       p = (long *) SCM_SMOB_DATA (res);
       rest = SCM_CDR (rest);
 
       while (SCM_CONSP (rest))
        {
-         int k;
          SCM cs = SCM_CAR (rest);
-         long *cs_data; 
+         long *cs_data;
 
          SCM_VALIDATE_SMOB (argnum, cs, charset);
          argnum++;
@@ -1172,8 +1174,14 @@
          rest = SCM_CDR (rest);
 
          for (k = 0; k < LONGS_PER_CHARSET; k++)
-           p[k] ^= cs_data[k];
+           {
+             mask[k] |= p[k] & cs_data[k];
+             p[k] ^= cs_data[k];
+           }
        }
+      /* avoid including characters that occur an odd number of times >= 3.  */
+      for (k = 0; k < LONGS_PER_CHARSET; k++)
+       p[k] &= ~mask[k];
     }
   return res;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]