guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-2-166-ge3


From: Michael Gran
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-2-166-ge354d76
Date: Wed, 09 Sep 2009 15:15:26 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=e354d7689aca1f6482bd90a2c367617222052265

The branch, master has been updated
       via  e354d7689aca1f6482bd90a2c367617222052265 (commit)
       via  f7f4d0477e2f67f0c1248da5d6e64044019196a3 (commit)
      from  0d05ae7c4b1eddf6257f99f44eaf5cb7b11191be (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e354d7689aca1f6482bd90a2c367617222052265
Author: Michael Gran <address@hidden>
Date:   Wed Sep 9 08:11:21 2009 -0700

    Avoid prematurely ending regexp test when ISO-8859-1 locale not found
    
    * test-suite/tests/regexp.test (with-latin1-locale): new function
      Call tests in context of with-latin1-locale

commit f7f4d0477e2f67f0c1248da5d6e64044019196a3
Author: Michael Gran <address@hidden>
Date:   Wed Sep 9 08:07:53 2009 -0700

    Make scm_i_from_stringn into API for use with libguilereadline
    
    * libguile/strings.c (scm_i_from_stringn): renamed to scm_from_stringn.
      All callers changed.
    
    * libguile/strings.h: change declaration of scm_i_from_stringn to
      scm_from_stringn
    
    * libguile/strports.c (scm_strport_to_string): scm_i_from_stringn ->
      scm_from_stringn
    
    * guile-readline/readline.c (internal_readline): scm_i_from_stringn ->
      scm_from_stringn

-----------------------------------------------------------------------

Summary of changes:
 guile-readline/readline.c    |    4 +-
 libguile/strings.c           |    8 +-
 libguile/strings.h           |    4 +-
 libguile/strports.c          |    4 +-
 test-suite/tests/regexp.test |  129 +++++++++++++++++++++++++----------------
 5 files changed, 89 insertions(+), 60 deletions(-)

diff --git a/guile-readline/readline.c b/guile-readline/readline.c
index a665415..5f6719d 100644
--- a/guile-readline/readline.c
+++ b/guile-readline/readline.c
@@ -259,8 +259,8 @@ internal_readline (SCM text)
     {
       scm_t_port *pt = SCM_PTAB_ENTRY (output_port);
       
-      ret = scm_i_from_stringn (s, strlen (s), pt->encoding, 
-                                SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE);
+      ret = scm_from_stringn (s, strlen (s), pt->encoding, 
+                              SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE);
     }
   else 
     ret = SCM_EOF_VAL;
diff --git a/libguile/strings.c b/libguile/strings.c
index 06e3359..5784a03 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1478,8 +1478,8 @@ scm_is_string (SCM obj)
 }
 
 SCM
-scm_i_from_stringn (const char *str, size_t len, const char *encoding,
-                    scm_t_string_failed_conversion_handler handler)
+scm_from_stringn (const char *str, size_t len, const char *encoding,
+                  scm_t_string_failed_conversion_handler handler)
 {
   size_t u32len, i;
   scm_t_wchar *u32;
@@ -1578,7 +1578,7 @@ scm_from_locale_stringn (const char *str, size_t len)
       hndl = SCM_FAILED_CONVERSION_ERROR;
     }
 
-  return scm_i_from_stringn (str, len, enc, hndl);
+  return scm_from_stringn (str, len, enc, hndl);
 }
 
 SCM
@@ -1593,7 +1593,7 @@ scm_from_locale_string (const char *str)
 SCM
 scm_i_from_utf8_string (const scm_t_uint8 *str)
 {
-  return scm_i_from_stringn ((const char *) str,
+  return scm_from_stringn ((const char *) str,
                            strlen ((char *) str), "UTF-8",
                            SCM_FAILED_CONVERSION_ERROR);
 }
diff --git a/libguile/strings.h b/libguile/strings.h
index 658d64d..c9c267e 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -111,7 +111,7 @@ SCM_API SCM scm_substring_shared (SCM str, SCM start, SCM 
end);
 SCM_API SCM scm_substring_copy (SCM str, SCM start, SCM end);
 SCM_API SCM scm_string_append (SCM args);
 
-SCM_API SCM scm_i_from_stringn (const char *str, size_t len, 
+SCM_API SCM scm_from_stringn (const char *str, size_t len, 
                                      const char *encoding,
                                      scm_t_string_failed_conversion_handler 
                                      handler);
@@ -157,7 +157,7 @@ SCM_INTERNAL const scm_t_wchar *scm_i_string_wide_chars 
(SCM str);
 SCM_INTERNAL SCM scm_i_string_start_writing (SCM str);
 SCM_INTERNAL void scm_i_string_stop_writing (void);
 SCM_INTERNAL int scm_i_is_narrow_string (SCM str);
-SCM_API scm_t_wchar scm_i_string_ref (SCM str, size_t x);
+SCM_INTERNAL scm_t_wchar scm_i_string_ref (SCM str, size_t x);
 SCM_INTERNAL int scm_i_string_contains_char (SCM str, char c);
 SCM_INTERNAL int scm_i_string_strcmp (SCM sstr, size_t start_x, const char 
*cstr);
 SCM_INTERNAL void scm_i_string_set_x (SCM str, size_t p, scm_t_wchar chr);
diff --git a/libguile/strports.c b/libguile/strports.c
index 82895ac..b984b83 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -380,8 +380,8 @@ SCM scm_strport_to_string (SCM port)
       memcpy (buf, pt->read_buf, pt->read_buf_size);
     }
   else
-    str = scm_i_from_stringn ((char *)pt->read_buf, pt->read_buf_size,
-                              pt->encoding, pt->ilseq_handler);
+    str = scm_from_stringn ((char *)pt->read_buf, pt->read_buf_size,
+                            pt->encoding, pt->ilseq_handler);
   scm_remember_upto_here_1 (port);
   return str;
 }
diff --git a/test-suite/tests/regexp.test b/test-suite/tests/regexp.test
index eac6527..9c48ea5 100644
--- a/test-suite/tests/regexp.test
+++ b/test-suite/tests/regexp.test
@@ -21,6 +21,8 @@
   #:use-module (test-suite lib)
   #:use-module (ice-9 regex))
 
+(setlocale LC_ALL "C")
+
 
 ;;; Run a regexp-substitute or regexp-substitute/global test, once
 ;;; providing a real port and once providing #f, requesting direct
@@ -130,58 +132,85 @@
 ;;; regexp-quote
 ;;;
 
+(define (with-latin1-locale thunk)
+  ;; Try out several ISO-8859-1 locales and run THUNK under the one that
+  ;; works (if any).
+  (define %locales
+    (append
+     (map (lambda (name)
+            (string-append name ".ISO-8859-1"))
+          '("fr_FR" "es_ES" "en_GB" "en_US" "de_DE" "pt_PT"))
+     (map (lambda (name)
+            (string-append name ".iso88591"))
+          '("fr_FR" "es_ES" "en_GB" "en_US" "de_DE" "pt_PT"))))
+
+
+  (let loop ((locales %locales))
+    (if (null? locales)
+        (throw 'unresolved)
+        (catch 'unresolved
+          (lambda ()
+            (with-locale (car locales) thunk))
+          (lambda (key . args)
+            (loop (cdr locales)))))))
+
+
+
 (with-test-prefix "regexp-quote"
 
-  (with-locale "en_US.iso88591"
-    (pass-if-exception "no args" exception:wrong-num-args
-      (regexp-quote))
-
-    (pass-if-exception "bad string arg" exception:wrong-type-arg
-      (regexp-quote 'blah))
-
-    (let ((lst `((regexp/basic    ,regexp/basic)
-                (regexp/extended ,regexp/extended)))
-          ;; string of all characters, except #\nul which doesn't work because
-          ;; it's the usual end-of-string for the underlying C regexec()
-          (allchars (list->string (map integer->char
-                                       (cdr (iota char-code-limit))))))
-      (for-each
-       (lambda (elem)
-         (let ((name (car  elem))
-               (flag (cadr elem)))
-
-           (with-test-prefix name
-
-            ;; try on each individual character, except #\nul
-            (do ((i 1 (1+ i)))
-                 ((>= i char-code-limit))
-               (let* ((c (integer->char i))
-                      (s (string c))
-                      (q (regexp-quote s)))
-                 (pass-if (list "char" i (format #f "~s ~s ~s" c s q))
-                   (let ((m (regexp-exec (make-regexp q flag) s)))
-                     (and (= 0 (match:start m))
-                          (= 1 (match:end m)))))))
-
-             ;; try on pattern "aX" where X is each character, except #\nul
-             ;; this exposes things like "?" which are special only when they
-             ;; follow a pattern to repeat or whatever ("a" in this case)
-             (do ((i 1 (1+ i)))
-                 ((>= i char-code-limit))
-               (let* ((c (integer->char i))
-                      (s (string #\a c))
-                      (q (regexp-quote s)))
-                 (pass-if (list "string \"aX\"" i (format #f "~s ~s ~s" c s q))
-                   (let ((m (regexp-exec (make-regexp q flag) s)))
-                     (and (= 0 (match:start m))
-                          (= 2 (match:end m)))))))
-
-             (pass-if "string of all chars"
-              (let ((m (regexp-exec (make-regexp (regexp-quote allchars)
-                                                  flag) allchars)))
-                 (and (= 0 (match:start m))
-                      (= (string-length allchars) (match:end m))))))))
-       lst))))
+  (pass-if-exception "no args" exception:wrong-num-args
+    (regexp-quote))
+
+  (pass-if-exception "bad string arg" exception:wrong-type-arg
+    (regexp-quote 'blah))
+
+  (let ((lst `((regexp/basic    ,regexp/basic)
+              (regexp/extended ,regexp/extended)))
+       ;; string of all characters, except #\nul which doesn't work because
+       ;; it's the usual end-of-string for the underlying C regexec()
+       (allchars (list->string (map integer->char
+                                    (cdr (iota char-code-limit))))))
+    (for-each
+     (lambda (elem)
+       (let ((name (car  elem))
+            (flag (cadr elem)))
+
+        (with-test-prefix name
+
+          ;; try on each individual character, except #\nul
+          (do ((i 1 (1+ i)))
+              ((>= i char-code-limit))
+             (let* ((c (integer->char i))
+                    (s (string c)))
+               (pass-if (list "char" i (format #f "~s ~s" c s))
+                 (with-latin1-locale
+                  (let* ((q (regexp-quote s))
+                         (m (regexp-exec (make-regexp q flag) s)))
+                    (and (= 0 (match:start m))
+                         (= 1 (match:end m))))))))
+
+          ;; try on pattern "aX" where X is each character, except #\nul
+          ;; this exposes things like "?" which are special only when they
+          ;; follow a pattern to repeat or whatever ("a" in this case)
+          (do ((i 1 (1+ i)))
+              ((>= i char-code-limit))
+             (let* ((c (integer->char i))
+                    (s (string #\a c))
+                    (q (regexp-quote s)))
+               (pass-if (list "string \"aX\"" i (format #f "~s ~s" c s))
+                 (with-latin1-locale
+                 (let* ((q (regexp-quote s))
+                         (m (regexp-exec (make-regexp q flag) s)))
+                    (and (= 0 (match:start m))
+                         (= 2 (match:end m))))))))
+
+          (pass-if "string of all chars"
+             (with-latin1-locale
+              (let ((m (regexp-exec (make-regexp (regexp-quote allchars)
+                                                 flag) allchars)))
+                (and (= 0 (match:start m))
+                     (= (string-length allchars) (match:end m)))))))))
+     lst)))
 
 ;;;
 ;;; regexp-substitute


hooks/post-receive
-- 
GNU Guile




reply via email to

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