guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-109-g95f5e


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-109-g95f5e30
Date: Thu, 17 Mar 2011 17:36:05 +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=95f5e303bc7f6174255b12fd1113d69364863762

The branch, stable-2.0 has been updated
       via  95f5e303bc7f6174255b12fd1113d69364863762 (commit)
      from  bb455e4f94d8e339c9b8a69e178110cf3dfa5bcb (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 95f5e303bc7f6174255b12fd1113d69364863762
Author: Andy Wingo <address@hidden>
Date:   Thu Mar 17 18:29:08 2011 +0100

    scm_{to,from}_locale_string use current locale, not current ports
    
    * libguile/strings.c (scm_to_locale_stringn, scm_from_locale_stringn):
      Use the encoding of the current locale, not of the current i/o ports.
      Also use the current conversion strategy.
    
    * doc/ref/api-data.texi (Conversion to/from C): Update docs.

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

Summary of changes:
 doc/ref/api-data.texi |   24 ++++++++++++------------
 libguile/strings.c    |   36 +++---------------------------------
 2 files changed, 15 insertions(+), 45 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index e519cab..0c4553f 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -4171,8 +4171,7 @@ using @code{scm_dynwind_free} inside an appropriate 
dynwind context,
 @deftypefn  {C Function} SCM scm_from_locale_string (const char *str)
 @deftypefnx {C Function} SCM scm_from_locale_stringn (const char *str, size_t 
len)
 Creates a new Scheme string that has the same contents as @var{str} when
-interpreted in the locale character encoding of the
address@hidden
+interpreted in the character encoding of the current locale.
 
 For @code{scm_from_locale_string}, @var{str} must be null-terminated.
 
@@ -4201,9 +4200,9 @@ can then use @var{str} directly as its internal 
representation.
 
 @deftypefn  {C Function} {char *} scm_to_locale_string (SCM str)
 @deftypefnx {C Function} {char *} scm_to_locale_stringn (SCM str, size_t *lenp)
-Returns a C string with the same contents as @var{str} in the locale
-encoding of the @code{current-output-port}.  The C string must be freed
-with @code{free} eventually, maybe by using @code{scm_dynwind_free},
+Returns a C string with the same contents as @var{str} in the character
+encoding of the current locale.  The C string must be freed with
address@hidden eventually, maybe by using @code{scm_dynwind_free},
 @xref{Dynamic Wind}.
 
 For @code{scm_to_locale_string}, the returned string is
@@ -4217,13 +4216,14 @@ returned string will not be null-terminated in this 
case.  If
 @var{lenp} is @code{NULL}, @code{scm_to_locale_stringn} behaves like
 @code{scm_to_locale_string}.
 
-If a character in @var{str} cannot be represented in the locale encoding
-of the current output port, the port conversion strategy of the current
-output port will determine the result, @xref{Ports}.  If output port's
-conversion strategy is @code{error}, an error will be raised.  If it is
address@hidden, a replacement character, such as a question mark, will
-be inserted in its place.  If it is @code{escape}, a hex escape will be
-inserted in its place.
+If a character in @var{str} cannot be represented in the character
+encoding of the current locale, the default port conversion strategy is
+used.  @xref{Ports}, for more on conversion strategies.
+
+If the conversion strategy is @code{error}, an error will be raised.  If
+it is @code{substitute}, a replacement character, such as a question
+mark, will be inserted in its place.  If it is @code{escape}, a hex
+escape will be inserted in its place.
 @end deftypefn
 
 @deftypefn {C Function} size_t scm_to_locale_stringbuf (SCM str, char *buf, 
size_t max_len)
diff --git a/libguile/strings.c b/libguile/strings.c
index b13cb78..6f4004b 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1528,25 +1528,8 @@ scm_from_locale_string (const char *str)
 SCM
 scm_from_locale_stringn (const char *str, size_t len)
 {
-  const char *enc;
-  scm_t_string_failed_conversion_handler hndl;
-  SCM inport;
-  scm_t_port *pt;
-
-  inport = scm_current_input_port ();
-  if (!SCM_UNBNDP (inport) && SCM_OPINPORTP (inport))
-    {
-      pt = SCM_PTAB_ENTRY (inport);
-      enc = pt->encoding;
-      hndl = pt->ilseq_handler;
-    }
-  else
-    {
-      enc = NULL;
-      hndl = SCM_FAILED_CONVERSION_ERROR;
-    }
-
-  return scm_from_stringn (str, len, enc, hndl);
+  return scm_from_stringn (str, len, locale_charset (),
+                           scm_i_get_conversion_strategy (SCM_BOOL_F));
 }
 
 SCM
@@ -1771,21 +1754,8 @@ scm_to_locale_string (SCM str)
 char *
 scm_to_locale_stringn (SCM str, size_t *lenp)
 {
-  SCM outport;
-  scm_t_port *pt;
-  const char *enc;
-
-  outport = scm_current_output_port ();
-  if (!SCM_UNBNDP (outport) && SCM_OPOUTPORTP (outport))
-    {
-      pt = SCM_PTAB_ENTRY (outport);
-      enc = pt->encoding;
-    }
-  else
-    enc = NULL;
-
   return scm_to_stringn (str, lenp, 
-                         enc,
+                         locale_charset (),
                          scm_i_get_conversion_strategy (SCM_BOOL_F));
 }
 


hooks/post-receive
-- 
GNU Guile



reply via email to

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