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-4-104-gee


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-4-104-gee2a69f
Date: Sat, 14 Nov 2009 16:02:23 +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=ee2a69f565032c6699ce6291e48b8624b2da16ba

The branch, master has been updated
       via  ee2a69f565032c6699ce6291e48b8624b2da16ba (commit)
       via  0ee42e27d51cd5af716aa43699a27343738d1ec6 (commit)
       via  f8a1c9a8594d5c64cd8b0dfada16ece6dcfe13f4 (commit)
       via  d6a6989e08a84cbf3c6b11c199536f665cbb6b50 (commit)
       via  c2be4e891c8cc085c4eb3f68125c95d86fae856c (commit)
      from  d61e866c764ba94dd55c4ca5d5a73f25a8f04437 (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 ee2a69f565032c6699ce6291e48b8624b2da16ba
Author: Ludovic Courtès <address@hidden>
Date:   Sat Nov 14 16:52:48 2009 +0100

    Add currently failing tests for optargs.
    
    * test-suite/tests/optargs.test (exception:unrecognized-keyword,
      exception:extraneous-arguments): New variables.
      ("define*")["extraneous arguments", "unrecognized keyword", "rest
      given before keywords"]: New tests.

commit 0ee42e27d51cd5af716aa43699a27343738d1ec6
Author: Ludovic Courtès <address@hidden>
Date:   Sat Nov 14 16:50:38 2009 +0100

    Explicitly disable TLS on NetBSD 5.0.
    
    * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Explicitly disable TLS on
      NetBSD 5.0.

commit f8a1c9a8594d5c64cd8b0dfada16ece6dcfe13f4
Author: Ludovic Courtès <address@hidden>
Date:   Sat Nov 14 16:27:28 2009 +0100

    Have `scm_scan_for_encoding ()' use GC-managed memory.
    
    * libguile/read.c (scm_scan_for_encoding): Rename to ...
      (scm_i_scan_for_encoding): ... this; update callers.  Use
      `scm_gc_strndup ()' instead of `scm_malloc ()'.
    
    * libguile/read.h: Update accordingly.
    
    * libguile/load.c (scm_primitive_load): Don't call free(3) on the value
      returned by `scm_i_scan_for_encoding ()'.

commit d6a6989e08a84cbf3c6b11c199536f665cbb6b50
Author: Ludovic Courtès <address@hidden>
Date:   Sat Nov 14 16:14:20 2009 +0100

    Replace `setbinary' by a public `%default-port-encoding' fluid.
    
    * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Add
      reference to the "Ports" node.
    
    * doc/ref/api-io.texi (Ports): Document `%default-port-encoding'.
    
    * libguile/ports.c (scm_port_encoding_var): Rename to...
      (default_port_encoding_var): ... this; update callers.  Make `static'.
    
    * libguile/posix.c (scm_setbinary): Remove.
    
    * libguile/posix.h: Adjust accordingly.
    
    * test-suite/tests/numbers.test: Remove unneeded `setbinary' call.
    
    * test-suite/tests/ports.test: Replace `setbinary' call by equivalent
      `%default-port-encoding' mutation and `set-port-encoding!' calls.
    
    * test-suite/tests/r6rs-ports.test: Replace `setbinary' call by
      equivalent `%default-port-encoding' mutation.

commit c2be4e891c8cc085c4eb3f68125c95d86fae856c
Author: Ludovic Courtès <address@hidden>
Date:   Sat Nov 14 11:42:14 2009 +0100

    Explicitly require `sed'.
    
    * configure.ac: Use `AC_PROG_SED'.

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

Summary of changes:
 acinclude.m4                     |   21 ++++++++++++++++-----
 configure.ac                     |    1 +
 doc/ref/api-evaluation.texi      |    7 +++++--
 doc/ref/api-io.texi              |    6 ++++++
 libguile/load.c                  |   11 +++++------
 libguile/ports.c                 |   30 ++++++++++++++++--------------
 libguile/posix.c                 |   28 ----------------------------
 libguile/posix.h                 |    3 +--
 libguile/read.c                  |   28 ++++++++++++----------------
 libguile/read.h                  |    4 ++--
 test-suite/tests/numbers.test    |    3 +--
 test-suite/tests/optargs.test    |   33 ++++++++++++++++++++++++++++++++-
 test-suite/tests/ports.test      |   10 +++++++---
 test-suite/tests/r6rs-ports.test |    4 ++--
 14 files changed, 106 insertions(+), 83 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 43a227b..7b2cfcb 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -343,11 +343,22 @@ AC_DEFUN([GUILE_THREAD_LOCAL_STORAGE], [
     [ac_cv_have_thread_storage_class],
     [dnl On some systems, e.g., NetBSD 5.0 with GCC 4.1, `__thread' is
      dnl properly compiled but fails to link due to the lack of TLS
-     dnl support in the C library.  Thus we try to link, not just compile.
-     AC_LINK_IFELSE([AC_LANG_PROGRAM([__thread int tls_integer;],
-                     [tls_integer = 123;])],
-       [ac_cv_have_thread_storage_class="yes"],
-       [ac_cv_have_thread_storage_class="no"])])
+     dnl support in the C library.  Thus we try to link, not just
+     dnl compile.  Unfortunately, this test is not enough, so we
+     dnl explicitly check for known-broken systems.  See
+     dnl http://lists.gnu.org/archive/html/guile-devel/2009-10/msg00138.html
+     dnl for details.
+     case "x$enable_shared--$host" in
+       xyes--*netbsd[0-5].[0-9])
+         ac_cv_have_thread_storage_class="no"
+        ;;
+       *)
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([__thread int tls_integer;],
+                         [tls_integer = 123;])],
+          [ac_cv_have_thread_storage_class="yes"],
+          [ac_cv_have_thread_storage_class="no"])
+        ;;
+     esac])
 
   if test "x$ac_cv_have_thread_storage_class" = "xyes"; then
      SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=1
diff --git a/configure.ac b/configure.ac
index 8771077..0912f9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,7 @@ AC_PROG_INSTALL
 AC_PROG_CC
 gl_EARLY
 AC_PROG_CPP
+AC_PROG_SED
 AC_PROG_AWK
 
 dnl Gnulib.
diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index e50a515..cd5a658 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -666,14 +666,17 @@ and @code{UTF-32} may not be used because they are not 
compatible with
 ASCII.
 
 @cindex read
address@hidden set-port-encoding!
address@hidden encoding
address@hidden port encoding
address@hidden set-port-encoding!
 There might be a scenario in which one would want to read non-ASCII
 code from a port, such as with the function @code{read}, instead of
 with @code{load}.  If the port's character encoding is the same as the
 encoding of the code to be read by the port, not other special
 handling is necessary.  The port will automatically do the character
 encoding conversion.  The functions @code{setlocale} or by
address@hidden are used to set port encodings.
address@hidden are used to set port encodings
+(@pxref{Ports}).
 
 If a port is used to read code of unknown character encoding, it can
 accomplish this in three steps.  First, the character encoding of the
diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index 83a2fd7..a5ffa23 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -111,6 +111,12 @@ Sets the character encoding that will be used to interpret 
all port
 I/O.  @var{enc} is a string containing the name of an encoding.  
 @end deffn
 
address@hidden {Scheme Variable} %default-port-encoding
+A fluid containing containing @code{#f} or the name of the encoding to
+be used by default for newly created ports (@pxref{Fluids and Dynamic
+States}).  The value @code{#f} is equivalent to @code{"ISO-8859-1"}.
address@hidden defvr
+
 New ports are created with the encoding appropriate for the current
 locale if @code{setlocale} has been called or ISO-8859-1 otherwise,
 and this procedure can be used to modify that encoding.
diff --git a/libguile/load.c b/libguile/load.c
index c6fbf5f..5c0c61e 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -98,15 +98,14 @@ SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0,
     SCM port = scm_open_file (filename, scm_from_locale_string ("r"));
     scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE);
     scm_i_dynwind_current_load_port (port);
-    encoding = scm_scan_for_encoding (port);
+
+    encoding = scm_i_scan_for_encoding (port);
     if (encoding)
-      {
-       scm_i_set_port_encoding_x (port, encoding);
-       free (encoding);
-      }
+      scm_i_set_port_encoding_x (port, encoding);
     else
-      /* The file has no encoding declaraed.  We'll presume Latin-1.  */
+      /* The file has no encoding declared.  We'll presume Latin-1.  */
       scm_i_set_port_encoding_x (port, NULL);
+
     while (1)
       {
        SCM reader, form;
diff --git a/libguile/ports.c b/libguile/ports.c
index c3415c7..8127e98 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1917,10 +1917,11 @@ SCM_DEFINE (scm_set_port_filename_x, 
"set-port-filename!", 2, 0, 0,
 }
 #undef FUNC_NAME
 
-/* The default port encoding for this locale. New ports will have this
-   encoding.  If it is a string, that is the encoding.  If it #f, it
-   is in the native (Latin-1) encoding.  */
-SCM_GLOBAL_VARIABLE (scm_port_encoding_var, "%port-encoding");
+/* A fluid specifying the default encoding for newly created ports.  If it is
+   a string, that is the encoding.  If it is #f, it is in the "native"
+   (Latin-1) encoding.  */
+SCM_VARIABLE (default_port_encoding_var, "%default-port-encoding");
+
 static int scm_port_encoding_init = 0;
 
 /* Return a C string representation of the current encoding.  */
@@ -1933,11 +1934,11 @@ scm_i_get_port_encoding (SCM port)
     {
       if (!scm_port_encoding_init)
        return NULL;
-      else if (!scm_is_fluid (SCM_VARIABLE_REF (scm_port_encoding_var)))
+      else if (!scm_is_fluid (SCM_VARIABLE_REF (default_port_encoding_var)))
        return NULL;
       else
        {
-         encoding = scm_fluid_ref (SCM_VARIABLE_REF (scm_port_encoding_var));
+         encoding = scm_fluid_ref (SCM_VARIABLE_REF 
(default_port_encoding_var));
          if (!scm_is_string (encoding))
            return NULL;
          else
@@ -2002,7 +2003,7 @@ scm_i_set_port_encoding_x (SCM port, const char *enc)
     {
       /* Set the default encoding for future ports.  */
       if (!scm_port_encoding_init
-         || !scm_is_fluid (SCM_VARIABLE_REF (scm_port_encoding_var)))
+         || !scm_is_fluid (SCM_VARIABLE_REF (default_port_encoding_var)))
        scm_misc_error (NULL, "tried to set port encoding fluid before it is 
initialized",
                        SCM_EOL);
 
@@ -2010,9 +2011,9 @@ scm_i_set_port_encoding_x (SCM port, const char *enc)
           || !strcmp (valid_enc, "ASCII")
           || !strcmp (valid_enc, "ANSI_X3.4-1968")
           || !strcmp (valid_enc, "ISO-8859-1"))
-        scm_fluid_set_x (SCM_VARIABLE_REF (scm_port_encoding_var), SCM_BOOL_F);
+        scm_fluid_set_x (SCM_VARIABLE_REF (default_port_encoding_var), 
SCM_BOOL_F);
       else
-        scm_fluid_set_x (SCM_VARIABLE_REF (scm_port_encoding_var), 
+        scm_fluid_set_x (SCM_VARIABLE_REF (default_port_encoding_var), 
                          scm_from_locale_string (valid_enc));
     }
   else
@@ -2045,7 +2046,7 @@ SCM_DEFINE (scm_port_encoding, "port-encoding", 1, 0, 0,
     return scm_from_locale_string ("NONE");
 }
 #undef FUNC_NAME
-  
+
 SCM_DEFINE (scm_set_port_encoding_x, "set-port-encoding!", 2, 0, 0,
            (SCM port, SCM enc),
            "Sets the character encoding that will be used to interpret all\n"
@@ -2053,7 +2054,6 @@ SCM_DEFINE (scm_set_port_encoding_x, 
"set-port-encoding!", 2, 0, 0,
            "appropriate for the current locale if @code{setlocale} has \n"
            "been called or ISO-8859-1 otherwise\n"
            "and this procedure can be used to modify that encoding.\n")
-
 #define FUNC_NAME s_scm_set_port_encoding_x
 {
   char *enc_str;
@@ -2347,12 +2347,14 @@ scm_init_ports ()
   cur_loadport_fluid = scm_permanent_object (scm_make_fluid ());
 
   scm_i_port_weak_hash = scm_permanent_object (scm_make_weak_key_hash_table 
(SCM_I_MAKINUM(31)));
+
 #include "libguile/ports.x"
 
-  SCM_VARIABLE_SET (scm_port_encoding_var, scm_make_fluid ());
-  scm_fluid_set_x (SCM_VARIABLE_REF (scm_port_encoding_var), SCM_BOOL_F);
+  /* Use Latin-1 as the default port encoding.  */
+  SCM_VARIABLE_SET (default_port_encoding_var, scm_make_fluid ());
+  scm_fluid_set_x (SCM_VARIABLE_REF (default_port_encoding_var), SCM_BOOL_F);
   scm_port_encoding_init = 1;
-  
+
   SCM_VARIABLE_SET (scm_conversion_strategy, scm_make_fluid ());
   scm_fluid_set_x (SCM_VARIABLE_REF (scm_conversion_strategy), 
                   scm_from_int ((int) SCM_FAILED_CONVERSION_QUESTION_MARK));
diff --git a/libguile/posix.c b/libguile/posix.c
index 7546953..5187ff9 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1554,34 +1554,6 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0,
 }
 #undef FUNC_NAME
 #endif /* HAVE_SETLOCALE */
-SCM_DEFINE (scm_setbinary, "setbinary", 0, 0, 0,
-            (void),
-           "Sets the encoding for the current input, output, and error\n"
-           "ports to ISO-8859-1.  That character encoding allows\n"
-           "ports to operate on binary data.\n"
-           "\n"
-           "It also sets the default encoding for newly created ports\n"
-           "to ISO-8859-1.\n"
-            "\n"
-            "The previous default encoding for new ports is returned\n")
-#define FUNC_NAME s_scm_setbinary
-{
-  const char *enc = scm_i_get_port_encoding (SCM_BOOL_F);
-
-  /* Set the default encoding for new ports.  */
-  scm_i_set_port_encoding_x (SCM_BOOL_F, NULL);
-  /* Set the encoding for the stdio ports.  */
-  scm_i_set_port_encoding_x (scm_current_input_port (), NULL);
-  scm_i_set_port_encoding_x (scm_current_output_port (), NULL);
-  scm_i_set_port_encoding_x (scm_current_error_port (), NULL);
-
-  if (enc)
-    return scm_from_locale_string (enc);
-
-  return scm_from_locale_string ("ISO-8859-1");
-}
-#undef FUNC_NAME
-
 
 #ifdef HAVE_MKNOD
 SCM_DEFINE (scm_mknod, "mknod", 4, 0, 0,
diff --git a/libguile/posix.h b/libguile/posix.h
index 2d93300..4171332 100644
--- a/libguile/posix.h
+++ b/libguile/posix.h
@@ -3,7 +3,7 @@
 #ifndef SCM_POSIX_H
 #define SCM_POSIX_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2006, 2008 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2006, 2008, 2009 Free 
Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -74,7 +74,6 @@ SCM_API SCM scm_access (SCM path, SCM how);
 SCM_API SCM scm_getpid (void);
 SCM_API SCM scm_putenv (SCM str);
 SCM_API SCM scm_setlocale (SCM category, SCM locale);
-SCM_API SCM scm_setbinary (void);
 SCM_API SCM scm_mknod (SCM path, SCM type, SCM perms, SCM dev);
 SCM_API SCM scm_nice (SCM incr);
 SCM_API SCM scm_sync (void);
diff --git a/libguile/read.c b/libguile/read.c
index fc56418..e403cc3 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -1460,10 +1460,11 @@ scm_get_hash_procedure (int c)
 
 #define SCM_ENCODING_SEARCH_SIZE (500)
 
-/* Search the first few hundred characters of a file for
-   an emacs-like coding declaration.  */
+/* Search the first few hundred characters of a file for an Emacs-like coding
+   declaration.  Returns either NULL or a string whose storage has been
+   allocated with `scm_gc_malloc ()'.  */
 char *
-scm_scan_for_encoding (SCM port)
+scm_i_scan_for_encoding (SCM port)
 {
   char header[SCM_ENCODING_SEARCH_SIZE+1];
   size_t bytes_read;
@@ -1512,9 +1513,7 @@ scm_scan_for_encoding (SCM port)
   if (i == 0)
     return NULL;
 
-  encoding = scm_malloc (i+1);
-  memcpy (encoding, pos, i);
-  encoding[i] ='\0';
+  encoding = scm_gc_strndup (pos, i + 1, "encoding");
   for (i = 0; i < strlen (encoding); i++)
     encoding[i] = toupper ((int) encoding[i]);
 
@@ -1540,16 +1539,14 @@ scm_scan_for_encoding (SCM port)
       i ++;
     }
   if (!in_comment)
-    {
-      /* This wasn't in a comment */
-      free (encoding);
-      return NULL;
-    }
+    /* This wasn't in a comment */
+    return NULL;
+
   if (utf8_bom && strcmp(encoding, "UTF-8"))
     scm_misc_error (NULL, 
                    "the port input declares the encoding ~s but is encoded as 
UTF-8",
                    scm_list_1 (scm_from_locale_string (encoding)));
-      
+
   return encoding;
 }
 
@@ -1566,17 +1563,16 @@ SCM_DEFINE (scm_file_encoding, "file-encoding", 1, 0, 0,
 {
   char *enc;
   SCM s_enc;
-  
-  enc = scm_scan_for_encoding (port);
+
+  enc = scm_i_scan_for_encoding (port);
   if (enc == NULL)
     return SCM_BOOL_F;
   else
     {
       s_enc = scm_from_locale_string (enc);
-      free (enc);
       return s_enc;
     }
-  
+
   return SCM_BOOL_F;
 }
 #undef FUNC_NAME
diff --git a/libguile/read.h b/libguile/read.h
index 7bc4a0b..4bd08fa 100644
--- a/libguile/read.h
+++ b/libguile/read.h
@@ -3,7 +3,7 @@
 #ifndef SCM_READ_H
 #define SCM_READ_H
 
-/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000, 2006, 2008, 2009 Free Software Foundation, 
Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -56,7 +56,7 @@ SCM_API SCM scm_read_options (SCM setting);
 SCM_API SCM scm_read (SCM port);
 SCM_API size_t scm_read_token (int ic, SCM * tok_buf, SCM port, int weird);
 SCM_API SCM scm_read_hash_extend (SCM chr, SCM proc);
-SCM_INTERNAL char *scm_scan_for_encoding (SCM port);
+SCM_INTERNAL char *scm_i_scan_for_encoding (SCM port);
 SCM_API SCM scm_file_encoding (SCM port);
 
 SCM_INTERNAL void scm_i_input_error (const char *func, SCM port,
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index 774e228..0391831 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -1,5 +1,5 @@
 ;;;; numbers.test --- tests guile's numbers     -*- scheme -*-
-;;;; Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006 Free Software 
Foundation, Inc.
+;;;; Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2009 Free Software 
Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,6 @@
 ;;;
 ;;; miscellaneous
 ;;;
-(setbinary)
 
 (define exception:numerical-overflow
   (cons 'numerical-overflow "^Numerical overflow"))
diff --git a/test-suite/tests/optargs.test b/test-suite/tests/optargs.test
index f8459ba..05b67e5 100644
--- a/test-suite/tests/optargs.test
+++ b/test-suite/tests/optargs.test
@@ -22,6 +22,20 @@
   #:use-module (system base compile)
   #:use-module (ice-9 optargs))
 
+(define exception:unrecognized-keyword
+  ;; Can be `vm-error' or `misc-error' depending on whether we use the
+  ;; interpreter or VM:
+  ;;  (vm-error vm-run "Bad keyword argument list: unrecognized keyword" ())
+  ;;  (misc-error #f "~A ~S" ("unrecognized keyword" (#:y 2)) #f)
+  (cons #t ".*"))
+
+(define exception:extraneous-arguments
+  ;; Can be `vm-error' or `misc-error' depending on whether we use the
+  ;; interpreter or VM, and depending on the evenness of the number of extra
+  ;; arguments (!).
+  (cons #t ".*"))
+
+
 (define-syntax c&e
   (syntax-rules (pass-if pass-if-exception)
     ((_ (pass-if test-name exp))
@@ -146,4 +160,21 @@
 (with-test-prefix/c&e "define*"
   (pass-if "the whole enchilada"
     (equal? (foo 1 2)
-            '(1 2 #f 1 #f #f #f 1 () ()))))
+            '(1 2 #f 1 #f #f #f 1 () ())))
+
+  (pass-if-exception "extraneous arguments"
+    exception:extraneous-arguments
+    (let ((f (lambda* (#:key x) x)))
+      (f 1 2 #:x 'x)))
+
+  (pass-if-exception "unrecognized keyword"
+    exception:unrecognized-keyword
+    (let ((f (lambda* (#:key x) x)))
+      (f #:y 'not-recognized)))
+
+  (pass-if "rest given before keywords"
+    ;; Passing the rest argument before the keyword arguments should not
+    ;; prevent keyword argument binding.
+    (let ((f (lambda* (#:key x y z #:rest r) (list x y z r))))
+      (equal? (f 1 2 3 #:x 'x #:z 'z)
+              '(x #f z (1 2 3 #:x x #:z z))))))
diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index 76b3e56..312467d 100644
--- a/test-suite/tests/ports.test
+++ b/test-suite/tests/ports.test
@@ -1,7 +1,7 @@
 ;;;; ports.test --- test suite for Guile I/O ports     -*- scheme -*-
 ;;;; Jim Blandy <address@hidden> --- May 1999
 ;;;;
-;;;;   Copyright (C) 1999, 2001, 2004, 2006, 2007 Free Software Foundation, 
Inc.
+;;;;   Copyright (C) 1999, 2001, 2004, 2006, 2007, 2009 Free Software 
Foundation, Inc.
 ;;;; 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -33,8 +33,12 @@
 
 ;;;; Some general utilities for testing ports.
 
-;;; Make sure we are set up for 8-bit data
-(setbinary)
+;; Make sure we are set up for 8-bit Latin-1 data.
+(fluid-set! %default-port-encoding "ISO-8859-1")
+(for-each (lambda (p)
+            (set-port-encoding! p (fluid-ref %default-port-encoding)))
+          (list (current-input-port) (current-output-port)
+                (current-error-port)))
 
 ;;; Read from PORT until EOF, and return the result as a string.
 (define (read-all port)
diff --git a/test-suite/tests/r6rs-ports.test b/test-suite/tests/r6rs-ports.test
index c2b0755..eb60cf3 100644
--- a/test-suite/tests/r6rs-ports.test
+++ b/test-suite/tests/r6rs-ports.test
@@ -27,8 +27,8 @@
 ;;; All these tests assume Guile 1.8's port system, where characters are
 ;;; treated as octets.
 
-;;; Set the default encoding of future ports to be binary
-(setbinary)
+;; Set the default encoding of future ports to be Latin-1.
+(fluid-set! %default-port-encoding #f)
 
 
 (with-test-prefix "7.2.5 End-of-File Object"


hooks/post-receive
-- 
GNU Guile




reply via email to

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