[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, string_abstraction2, updated. release_
From: |
Michael Gran |
Subject: |
[Guile-commits] GNU Guile branch, string_abstraction2, updated. release_1-9-1-144-gca2858c |
Date: |
Wed, 12 Aug 2009 14:58:09 +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=ca2858c6ba827675af1e348b740b868abc1fdc8d
The branch, string_abstraction2 has been updated
via ca2858c6ba827675af1e348b740b868abc1fdc8d (commit)
from 073f04e57d052ea740ffb097182cad7d2c2a702a (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 ca2858c6ba827675af1e348b740b868abc1fdc8d
Author: Michael Gran <address@hidden>
Date: Wed Aug 12 07:49:16 2009 -0700
Don't include libunistring headers in Guile public headers
This requres the creation of a new type
scm_t_string_failed_conversion_handler to replace libunistring's
enum iconveh_ilseq_handler.
* libguile/strings.h (scm_t_string_failed_conversion_handler):
new enum type
(SCM_FAILED_CONVERSION_ERROR, SCM_FAILED_CONVERSION_QUESTION_MARK):
(SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE): new enum type values
Don't include <uniconv.h>
* libguile/strings.c (scm_from_locale_stringn):
(scm_to_stringn): now takes type
scm_t_string_failed_conversion_handler. All callers changed.
* libguile/print.c: include <uniconv.h>
* libguile/ports.h: don't include <uniconv.h>. Modified
declarations for scm_i_get_conversion_strategy,
scm_i_set_conversion_strategy_x, and scm_t_port.
* libguile/ports.c (scm_i_get_conversion_strategy): now returns
scm_t_string_failed_conversion_handler. Callers changed.
(scm_i_set_conversion_strategy_x): now takes
scm_t_string_failed_conversion_handler. Callers changed.
(scm_getc, scm_port_conversion_strategy):
(scm_set_port_conversion_strategy_x):
(scm_init_ports): use scm_t_string_conversion_handler type
and related constants
* libguile/gen-scmconfig.c (SCM_ICONVEH_ERROR):
(SCM_ICONVEH_QUESTION_MARK, SCM_ICONVEH_ESCAPE_SEQUENCE): store
iconveh_ilseq_hander constants as #define's
-----------------------------------------------------------------------
Summary of changes:
libguile/gen-scmconfig.c | 9 +++++++++
libguile/ports.c | 31 +++++++++++++++++--------------
libguile/ports.h | 9 ++++-----
libguile/print.c | 3 ++-
libguile/strings.c | 9 +++++----
libguile/strings.h | 15 ++++++++++++---
6 files changed, 49 insertions(+), 27 deletions(-)
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index d569638..ef1ad4c 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -125,6 +125,7 @@
#include <stdio.h>
#include <string.h>
+#include <uniconv.h>
#define pf printf
@@ -424,6 +425,14 @@ main (int argc, char *argv[])
pf ("#define SCM_HAVE_ARRAYS 1 /* always true now */\n");
+ pf ("\n");
+ pf ("/* Constants from uniconv.h. */\n");
+ pf ("#define SCM_ICONVEH_ERROR %d\n", (int) iconveh_error);
+ pf ("#define SCM_ICONVEH_QUESTION_MARK %d\n",
+ (int) iconveh_question_mark);
+ pf ("#define SCM_ICONVEH_ESCAPE_SEQUENCE %d\n",
+ (int) iconveh_escape_sequence);
+
printf ("#endif\n");
return 0;
diff --git a/libguile/ports.c b/libguile/ports.c
index f58ac44..7560ae6 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -999,7 +999,8 @@ scm_getc (SCM port)
for (;;)
{
- u32 = u32_conv_from_encoding (pt->encoding, pt->ilseq_handler,
+ u32 = u32_conv_from_encoding (pt->encoding,
+ (enum iconv_ilseq_handler)
pt->ilseq_handler,
buf, bufcount, NULL, NULL, &u32len);
if (u32 == NULL || u32len == 0)
{
@@ -1998,7 +1999,7 @@ SCM_DEFINE (scm_set_port_encoding_x,
"set-port-encoding!", 2, 0, 0,
SCM_GLOBAL_VARIABLE (scm_conversion_strategy, "%port-conversion-strategy");
static int scm_conversion_strategy_init = 0;
-enum iconv_ilseq_handler
+scm_t_string_failed_conversion_handler
scm_i_get_conversion_strategy (SCM port)
{
SCM encoding;
@@ -2007,14 +2008,14 @@ scm_i_get_conversion_strategy (SCM port)
{
if (!scm_conversion_strategy_init
|| !scm_is_fluid (SCM_VARIABLE_REF (scm_conversion_strategy)))
- return iconveh_question_mark;
+ return SCM_FAILED_CONVERSION_QUESTION_MARK;
else
{
encoding = scm_fluid_ref (SCM_VARIABLE_REF (scm_conversion_strategy));
if (scm_is_false (encoding))
- return iconveh_question_mark;
+ return SCM_FAILED_CONVERSION_QUESTION_MARK;
else
- return (enum iconv_ilseq_handler) scm_to_int (encoding);
+ return (scm_t_string_failed_conversion_handler) scm_to_int
(encoding);
}
}
else
@@ -2028,7 +2029,7 @@ scm_i_get_conversion_strategy (SCM port)
void
scm_i_set_conversion_strategy_x (SCM port,
- const enum iconv_ilseq_handler handler)
+ scm_t_string_failed_conversion_handler handler)
{
SCM strategy;
scm_t_port *pt;
@@ -2067,7 +2068,7 @@ SCM_DEFINE (scm_port_conversion_strategy,
"port-conversion-strategy",
"when they are created.\n")
#define FUNC_NAME s_scm_port_conversion_strategy
{
- enum iconv_ilseq_handler h;
+ scm_t_string_failed_conversion_handler h;
SCM_VALIDATE_OPPORT (1, port);
@@ -2077,11 +2078,11 @@ SCM_DEFINE (scm_port_conversion_strategy,
"port-conversion-strategy",
}
h = scm_i_get_conversion_strategy (port);
- if (h == iconveh_error)
+ if (h == SCM_FAILED_CONVERSION_ERROR)
return scm_from_locale_symbol ("error");
- else if (h == iconveh_question_mark)
+ else if (h == SCM_FAILED_CONVERSION_QUESTION_MARK)
return scm_from_locale_symbol ("substitute");
- else if (h == iconveh_escape_sequence)
+ else if (h == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE)
return scm_from_locale_symbol ("escape");
else
abort ();
@@ -2123,21 +2124,23 @@ SCM_DEFINE (scm_set_port_conversion_strategy_x,
"set-port-conversion-strategy!",
err = scm_from_locale_symbol ("error");
if (scm_is_true (scm_eqv_p (sym, err)))
{
- scm_i_set_conversion_strategy_x (port, iconveh_error);
+ scm_i_set_conversion_strategy_x (port, SCM_FAILED_CONVERSION_ERROR);
return SCM_UNSPECIFIED;
}
qm = scm_from_locale_symbol ("substitute");
if (scm_is_true (scm_eqv_p (sym, qm)))
{
- scm_i_set_conversion_strategy_x (port, iconveh_question_mark);
+ scm_i_set_conversion_strategy_x (port,
+ SCM_FAILED_CONVERSION_QUESTION_MARK);
return SCM_UNSPECIFIED;
}
esc = scm_from_locale_symbol ("escape");
if (scm_is_true (scm_eqv_p (sym, esc)))
{
- scm_i_set_conversion_strategy_x (port, iconveh_escape_sequence);
+ scm_i_set_conversion_strategy_x (port,
+ SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE);
return SCM_UNSPECIFIED;
}
@@ -2269,7 +2272,7 @@ scm_init_ports ()
SCM_VARIABLE_SET (scm_conversion_strategy, scm_make_fluid ());
scm_fluid_set_x (SCM_VARIABLE_REF (scm_conversion_strategy),
- scm_from_int ((int) iconveh_question_mark));
+ scm_from_int ((int) SCM_FAILED_CONVERSION_QUESTION_MARK));
scm_conversion_strategy_init = 1;
}
diff --git a/libguile/ports.h b/libguile/ports.h
index fa303d4..4274ff0 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -29,8 +29,7 @@
#include "libguile/struct.h"
#include "libguile/threads.h"
#include "libguile/chars.h"
-
-#include <uniconv.h>
+#include "libguile/strings.h"
@@ -61,7 +60,7 @@ typedef struct
/* Character encoding support */
char *encoding;
- enum iconv_ilseq_handler ilseq_handler;
+ scm_t_string_failed_conversion_handler ilseq_handler;
/* port buffers. the buffer(s) are set up for all ports.
in the case of string ports, the buffer is the string itself.
@@ -301,9 +300,9 @@ SCM_INTERNAL const char *scm_i_get_port_encoding (SCM port);
SCM_INTERNAL void scm_i_set_port_encoding_x (SCM port, const char *str);
SCM_API SCM scm_port_encoding (SCM port);
SCM_API SCM scm_set_port_encoding_x (SCM port, SCM encoding);
-SCM_INTERNAL enum iconv_ilseq_handler scm_i_get_conversion_strategy (SCM port);
+SCM_INTERNAL scm_t_string_failed_conversion_handler
scm_i_get_conversion_strategy (SCM port);
SCM_INTERNAL void scm_i_set_conversion_strategy_x (SCM port,
- enum iconv_ilseq_handler h);
+
scm_t_string_failed_conversion_handler h);
SCM_API SCM scm_port_conversion_strategy (SCM port);
SCM_API SCM scm_set_port_conversion_strategy_x (SCM port, SCM behavior);
SCM_API int scm_port_print (SCM exp, SCM port, scm_print_state *);
diff --git a/libguile/print.c b/libguile/print.c
index 1111bf0..f1e7ad4 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -23,6 +23,7 @@
#endif
#include <errno.h>
+#include <uniconv.h>
#include <unictype.h>
#include "libguile/_scm.h"
@@ -627,7 +628,7 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate)
buf = u32_conv_to_encoding (scm_i_get_port_encoding
(port),
iconveh_error,
- (scm_t_uint32 *) wbuf
,
+ (scm_t_uint32 *) wbuf,
1 ,
NULL,
NULL, &len);
diff --git a/libguile/strings.c b/libguile/strings.c
index 17fddc8..79eeb57 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1463,6 +1463,7 @@ scm_from_locale_stringn (const char *str, size_t len)
u32len = 0;
u32 = (scm_t_wchar *) u32_conv_from_encoding (enc,
+ (enum iconv_ilseq_handler)
scm_i_get_conversion_strategy
(SCM_BOOL_F),
str, len,
NULL,
@@ -1635,7 +1636,7 @@ scm_to_locale_stringn (SCM str, size_t * lenp)
char *
scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
- enum iconv_ilseq_handler handler)
+ scm_t_string_failed_conversion_handler handler)
{
char *buf;
size_t ilen, len, i;
@@ -1688,10 +1689,10 @@ scm_to_stringn (SCM str, size_t *lenp, const char
*encoding,
{
ret = mem_iconveh (scm_i_string_chars (str), ilen,
"ISO-8859-1", enc,
- handler, NULL,
+ (enum iconv_ilseq_handler) handler, NULL,
&buf, &len);
- if (ret == 0 && handler == iconveh_escape_sequence)
+ if (ret == 0 && handler == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE)
unistring_escapes_to_guile_escapes (&buf, &len);
if (ret != 0)
@@ -1704,7 +1705,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char
*encoding,
else
{
buf = u32_conv_to_encoding (enc,
- handler,
+ (enum iconv_ilseq_handler) handler,
(scm_t_uint32 *) scm_i_string_wide_chars
(str),
ilen,
NULL,
diff --git a/libguile/strings.h b/libguile/strings.h
index e67ee2e..97ec643 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -3,7 +3,7 @@
#ifndef SCM_STRINGS_H
#define SCM_STRINGS_H
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2004, 2005, 2006, 2008 Free
Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2004, 2005, 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
@@ -23,7 +23,6 @@
-#include <uniconv.h>
#include "libguile/__scm.h"
@@ -90,6 +89,15 @@
no wide version of this interface.
*/
+/* A type indicating what strategy to take when string locale
+ conversion is unsuccessful. */
+typedef enum
+{
+ SCM_FAILED_CONVERSION_ERROR = SCM_ICONVEH_ERROR,
+ SCM_FAILED_CONVERSION_QUESTION_MARK = SCM_ICONVEH_QUESTION_MARK,
+ SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE = SCM_ICONVEH_ESCAPE_SEQUENCE
+} scm_t_string_failed_conversion_handler;
+
#define SCM_PORT_ENCODING (scm_i_get_port_encoding())
SCM_API SCM scm_string_p (SCM x);
@@ -125,7 +133,8 @@ SCM_API char *scm_to_locale_string (SCM str);
SCM_API char *scm_to_locale_stringn (SCM str, size_t *lenp);
SCM_INTERNAL char *scm_to_stringn (SCM str, size_t *lenp,
const char *encoding,
- enum iconv_ilseq_handler handler);
+ scm_t_string_failed_conversion_handler
+ handler);
SCM_INTERNAL scm_t_uint8 *scm_i_to_utf8_string (SCM str);
SCM_API size_t scm_to_locale_stringbuf (SCM str, char *buf, size_t max_len);
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, string_abstraction2, updated. release_1-9-1-144-gca2858c,
Michael Gran <=