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 srfi-...


From: Martin Grabmueller
Subject: guile/guile-core/srfi ChangeLog srfi-14.c srfi-...
Date: Tue, 17 Jul 2001 12:40:29 -0700

CVSROOT:        /cvs
Module name:    guile
Branch:         branch_release-1-6
Changes by:     Martin Grabmueller <address@hidden>     01/07/17 12:40:29

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

Log message:
        * srfi-14.c: Okay.  Now I got it.  Really.  This time it's fixed.
        Guaranteed. (Maybe)
        
        * srfi-19.scm: Define `current-time' before exporting it.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/srfi/ChangeLog.diff?cvsroot=OldCVS&only_with_tag=branch_release-1-6&tr1=1.44.2.10&tr2=1.44.2.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/srfi/srfi-14.c.diff?cvsroot=OldCVS&only_with_tag=branch_release-1-6&tr1=1.9.2.8&tr2=1.9.2.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/srfi/srfi-19.scm.diff?cvsroot=OldCVS&only_with_tag=branch_release-1-6&tr1=1.9&tr2=1.9.2.1&r1=text&r2=text

Patches:
Index: guile/guile-core/srfi/ChangeLog
diff -u guile/guile-core/srfi/ChangeLog:1.53 
guile/guile-core/srfi/ChangeLog:1.54
--- guile/guile-core/srfi/ChangeLog:1.53        Mon Jul 16 15:30:25 2001
+++ guile/guile-core/srfi/ChangeLog     Mon Jul 16 22:35:51 2001
@@ -1,3 +1,12 @@
+2001-07-17  Martin Grabmueller  <address@hidden>
+
+       * srfi-14.c: Fix for bug caused by brain-malfunctioning on my
+       side.  Bit sets were handled wrong because I couldn't tell bit
+       counts from byte counts.  Also, the bit array should be 256 / 8
+       bytes long.  Thank you, Gary!   
+
+       Removed unnecessary protoype for scm_char_set_copy.
+
 2001-07-16  Gary Houston  <address@hidden>
 
        * srfi-14.scm: export string->char-set!, not string-char-set!.
Index: guile/guile-core/srfi/srfi-14.c
diff -u guile/guile-core/srfi/srfi-14.c:1.16 
guile/guile-core/srfi/srfi-14.c:1.17
--- guile/guile-core/srfi/srfi-14.c:1.16        Mon Jul 16 15:30:25 2001
+++ guile/guile-core/srfi/srfi-14.c     Mon Jul 16 22:35:51 2001
@@ -50,10 +50,10 @@
 
 #include "srfi-14.h"
 
-#define SCM_CHARSET_SET(cs, idx) (((long *) SCM_SMOB_DATA (cs))[(idx) / sizeof 
(long)] |= (1 << ((idx) % sizeof (long))))
 
-SCM scm_char_set_copy (SCM cs);
+#define SCM_CHARSET_SET(cs, idx) (((long *) SCM_SMOB_DATA (cs))[(idx) / 
SCM_BITS_PER_LONG] |= (1 << ((idx) % SCM_BITS_PER_LONG)))
 
+
 /* Smob type code for character sets.  */
 int scm_tc16_charset = 0;
 
@@ -94,8 +94,8 @@
 {
   long * p;
   
-  p = scm_must_malloc (SCM_CHARSET_SIZE / sizeof (char), func_name);
-  memset (p, 0, SCM_CHARSET_SIZE / sizeof (char));
+  p = scm_must_malloc (SCM_CHARSET_SIZE / 8, func_name);
+  memset (p, 0, SCM_CHARSET_SIZE / 8);
   SCM_RETURN_NEWSMOB (scm_tc16_charset, p);
 }
 
@@ -131,8 +131,7 @@
       csi_data = (long *) SCM_SMOB_DATA (csi);
       if (cs1_data == NULL)
        cs1_data = csi_data;
-      else if (memcmp (cs1_data, csi_data,
-                      SCM_CHARSET_SIZE / sizeof (char)) != 0)
+      else if (memcmp (cs1_data, csi_data, SCM_CHARSET_SIZE / 8) != 0)
        return SCM_BOOL_F;
       char_sets = SCM_CDR (char_sets);
     }
@@ -476,7 +475,7 @@
       SCM_VALIDATE_CHAR_COPY (argnum, SCM_CAR (rest), c);
       argnum++;
       rest = SCM_CDR (rest);
-      p[c / sizeof (long)] |= 1 << (c % sizeof (long));
+      p[c / SCM_BITS_PER_LONG] |= 1 << (c % SCM_BITS_PER_LONG);
     }
   return cs;
 }
@@ -510,7 +509,7 @@
       SCM_VALIDATE_CHAR_COPY (0, chr, c);
       list = SCM_CDR (list);
 
-      p[c / sizeof (long)] |= 1 << (c % sizeof (long));
+      p[c / SCM_BITS_PER_LONG] |= 1 << (c % SCM_BITS_PER_LONG);
     }
   return cs;
 }
@@ -537,7 +536,7 @@
       SCM_VALIDATE_CHAR_COPY (0, chr, c);
       list = SCM_CDR (list);
 
-      p[c / sizeof (long)] |= 1 << (c % sizeof (long));
+      p[c / SCM_BITS_PER_LONG] |= 1 << (c % SCM_BITS_PER_LONG);
     }
   return base_cs;
 }
@@ -569,7 +568,7 @@
   while (k < SCM_STRING_LENGTH (str))
     {
       int c = s[k++];
-      p[c / sizeof (long)] |= 1 << (c % sizeof (long));
+      p[c / SCM_BITS_PER_LONG] |= 1 << (c % SCM_BITS_PER_LONG);
     }
   return cs;
 }
@@ -594,7 +593,7 @@
   while (k < SCM_STRING_LENGTH (str))
     {
       int c = s[k++];
-      p[c / sizeof (long)] |= 1 << (c % sizeof (long));
+      p[c / SCM_BITS_PER_LONG] |= 1 << (c % SCM_BITS_PER_LONG);
     }
   return base_cs;
 }
@@ -629,7 +628,7 @@
          SCM res = scm_call_1 (pred, SCM_MAKE_CHAR (k));
 
          if (!SCM_FALSEP (res))
-           p[k / sizeof (long)] |= 1 << (k % sizeof (long));
+           p[k / SCM_BITS_PER_LONG] |= 1 << (k % SCM_BITS_PER_LONG);
        }
     }
   return ret;
@@ -658,7 +657,7 @@
          SCM res = scm_call_1 (pred, SCM_MAKE_CHAR (k));
 
          if (!SCM_FALSEP (res))
-           p[k / sizeof (long)] |= 1 << (k % sizeof (long));
+           p[k / SCM_BITS_PER_LONG] |= 1 << (k % SCM_BITS_PER_LONG);
        }
     }
   return base_cs;
@@ -712,7 +711,7 @@
   p = (long *) SCM_SMOB_DATA (cs);
   while (clower < cupper)
     {
-      p[clower / sizeof (long)] |= 1 << (clower % sizeof (long));
+      p[clower / SCM_BITS_PER_LONG] |= 1 << (clower % SCM_BITS_PER_LONG);
       clower++;
     }
   return cs;
@@ -755,7 +754,7 @@
   p = (long *) SCM_SMOB_DATA (base_cs);
   while (clower < cupper)
     {
-      p[clower / sizeof (long)] |= 1 << (clower % sizeof (long));
+      p[clower / SCM_BITS_PER_LONG] |= 1 << (clower % SCM_BITS_PER_LONG);
       clower++;
     }
   return base_cs;
@@ -928,7 +927,7 @@
       SCM_VALIDATE_CHAR_COPY (1, chr, c);
       rest = SCM_CDR (rest);
 
-      p[c / sizeof (long)] |= 1 << (c % sizeof (long));
+      p[c / SCM_BITS_PER_LONG] |= 1 << (c % SCM_BITS_PER_LONG);
     }
   return cs;
 }
@@ -956,7 +955,7 @@
       SCM_VALIDATE_CHAR_COPY (1, chr, c);
       rest = SCM_CDR (rest);
 
-      p[c / sizeof (long)] &= ~(1 << (c % sizeof (long)));
+      p[c / SCM_BITS_PER_LONG] &= ~(1 << (c % SCM_BITS_PER_LONG));
     }
   return cs;
 }
@@ -983,7 +982,7 @@
       SCM_VALIDATE_CHAR_COPY (1, chr, c);
       rest = SCM_CDR (rest);
 
-      p[c / sizeof (long)] |= 1 << (c % sizeof (long));
+      p[c / SCM_BITS_PER_LONG] |= 1 << (c % SCM_BITS_PER_LONG);
     }
   return cs;
 }
@@ -1010,7 +1009,7 @@
       SCM_VALIDATE_CHAR_COPY (1, chr, c);
       rest = SCM_CDR (rest);
 
-      p[c / sizeof (long)] &= ~(1 << (c % sizeof (long)));
+      p[c / SCM_BITS_PER_LONG] &= ~(1 << (c % SCM_BITS_PER_LONG));
     }
   return cs;
 }
@@ -1129,7 +1128,7 @@
 
 SCM_DEFINE (scm_char_set_xor, "char-set-xor", 1, 0, 1,
            (SCM cs1, SCM rest),
-           "Return the exclusive--or of all argument character sets.")
+           "Return the exclusive-or of all argument character sets.")
 #define FUNC_NAME s_scm_char_set_xor
 {
   int c = 2;
@@ -1296,7 +1295,7 @@
 
 SCM_DEFINE (scm_char_set_xor_x, "char-set-xor!", 1, 0, 1,
            (SCM cs1, SCM rest),
-           "Return the exclusive--or of all argument character sets.")
+           "Return the exclusive-or of all argument character sets.")
 #define FUNC_NAME s_scm_char_set_xor_x
 {
   int c = 2;
@@ -1369,8 +1368,8 @@
 
   if (!initialized)
     {
-      scm_tc16_charset = scm_make_smob_type ("character-set", 
-                                            SCM_CHARSET_SIZE / sizeof (char));
+      scm_tc16_charset = scm_make_smob_type ("character-set",
+                                            SCM_CHARSET_SIZE / 8);
       scm_set_smob_free (scm_tc16_charset, charset_free);
       scm_set_smob_print (scm_tc16_charset, charset_print);
       initialized = 1;
Index: guile/guile-core/srfi/srfi-19.scm
diff -u guile/guile-core/srfi/srfi-19.scm:1.8 
guile/guile-core/srfi/srfi-19.scm:1.9
--- guile/guile-core/srfi/srfi-19.scm:1.8       Mon Jun 18 11:30:58 2001
+++ guile/guile-core/srfi/srfi-19.scm   Fri Jul  6 07:00:13 2001
@@ -1362,18 +1362,18 @@
 
 ;; looking at a char, read the char string, run thru indexer, return index
 (define (priv:locale-reader port indexer)
-  (let ((string-port (open-output-string)))
-    (define (read-char-string)
-      (let ((ch (peek-char port)))
-        (if (char-alphabetic? ch)
-            (begin (write-char (read-char port) string-port) 
-                   (read-char-string))
-            (get-output-string string-port))))
-    (let* ((str (read-char-string)) 
-           (index (indexer str)))
-      (if index index (priv:time-error 'string->date
-                                       'bad-date-template-string
-                                       (list "Invalid string for " 
indexer))))))
+
+  (define (read-char-string result)
+    (let ((ch (peek-char port)))
+      (if (char-alphabetic? ch)
+          (read-char-string (cons (read-char port) result))
+          (list->string (reverse! result)))))
+  
+  (let* ((str (read-char-string '())) 
+         (index (indexer str)))
+    (if index index (priv:time-error 'string->date
+                                     'bad-date-template-string
+                                     (list "Invalid string for " indexer)))))
 
 (define (priv:make-locale-reader indexer)
   (lambda (port)



reply via email to

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