[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. release_1-9-1-64-geca
From: |
Michael Gran |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-1-64-geca29b0 |
Date: |
Wed, 12 Aug 2009 16:26:51 +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=eca29b020267c477bddc3f9df6f087f461f7c8b9
The branch, master has been updated
via eca29b020267c477bddc3f9df6f087f461f7c8b9 (commit)
via 3c7cf7f5c04bf93222c133d5939badd75e627f6e (commit)
via bd4911efd239a0a09d3deb5c8dec0b727fff86ef (commit)
from 94ff26b96b555f0263fab2221cd55801119ffddd (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 eca29b020267c477bddc3f9df6f087f461f7c8b9
Author: Michael Gran <address@hidden>
Date: Wed Aug 12 08:30:59 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: don't include <uniconv.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
* libguile/strings.c (scm_to_stringn): now takes type
scm_t_string_failed_conversion_handler. All callers changed.
* libguile/print.c: include <uniconv.h>
* libguile/ports.c (scm_lfwrite_substr): use
scm_t_string_conversion_handler's constants
* libguile/gen-scmconfig.c (SCM_ICONVEH_ERROR):
(SCM_ICONVEH_QUESTION_MARK, SCM_ICONVEH_ESCAPE_SEQUENCE): store
iconveh_ilseq_hander constants as #define's
commit 3c7cf7f5c04bf93222c133d5939badd75e627f6e
Author: Michael Gran <address@hidden>
Date: Wed Aug 12 09:21:37 2009 -0700
Regression, scm_string fails to test for circular lists
* libguile/string.c (scm_string): Restores the functionality
where scm_string tests for circular lists
* test-suite/tests/strings.test: add test for circular lists
commit bd4911efd239a0a09d3deb5c8dec0b727fff86ef
Author: Michael Gran <address@hidden>
Date: Wed Aug 12 08:50:12 2009 -0700
Some signed/unsigned comparison and conversions
* libguile/ports.c (scm_lfwrite_str, scm_lfwrite_substr): signed/unsigned
conversion and comparison
* libguile/strings.c (scm_string_append): signed/unsigned comparison
-----------------------------------------------------------------------
Summary of changes:
libguile/gen-scmconfig.c | 9 +++++++++
libguile/ports.c | 6 +++---
libguile/print.c | 1 +
libguile/strings.c | 15 +++++++++------
libguile/strings.h | 15 ++++++++++++---
test-suite/tests/strings.test | 12 +++++++++++-
6 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index d569638..0e897ca 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 4ed5f76..60b21dd 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1019,12 +1019,12 @@ scm_lfwrite_substr (SCM str, size_t start, size_t end,
SCM port)
if (pt->rw_active == SCM_PORT_READ)
scm_end_input (port);
- if (end == -1)
+ if (end == (size_t) (-1))
end = size;
size = end - start;
buf = scm_to_stringn (scm_c_substring (str, start, end), &len,
- NULL, iconveh_escape_sequence);
+ NULL, SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE);
ptob->write (port, buf, len);
free (buf);
@@ -1042,7 +1042,7 @@ scm_lfwrite_substr (SCM str, size_t start, size_t end,
SCM port)
void
scm_lfwrite_str (SCM str, SCM port)
{
- scm_lfwrite_substr (str, 0, -1, port);
+ scm_lfwrite_substr (str, 0, (size_t) (-1), port);
}
/* scm_c_read
diff --git a/libguile/print.c b/libguile/print.c
index 85f030e..c398572 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"
diff --git a/libguile/strings.c b/libguile/strings.c
index 74cebd6..03fb4b4 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <ctype.h>
#include <unistr.h>
+#include <uniconv.h>
#include "libguile/_scm.h"
#include "libguile/chars.h"
@@ -1015,10 +1016,11 @@ SCM_DEFINE (scm_string, "string", 0, 0, 1,
/* Verify that this is a list of chars. */
i = scm_ilength (chrs);
+ SCM_ASSERT (i >= 0, chrs, SCM_ARG1, FUNC_NAME);
+
len = (size_t) i;
rest = chrs;
- SCM_ASSERT (len >= 0, chrs, SCM_ARG1, FUNC_NAME);
while (len > 0 && scm_is_pair (rest))
{
SCM elt = SCM_CAR (rest);
@@ -1297,7 +1299,7 @@ SCM_DEFINE (scm_string_append, "string-append", 0, 0, 1,
size_t len = 0;
int wide = 0;
SCM l, s;
- int i;
+ size_t i;
union
{
char *narrow;
@@ -1472,13 +1474,14 @@ scm_to_locale_stringn (SCM str, size_t * lenp)
/* In the future, enc will hold the port's encoding. */
enc = NULL;
- return scm_to_stringn (str, lenp, enc, iconveh_escape_sequence);
+ return scm_to_stringn (str, lenp, enc,
+ SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE);
}
/* Low-level scheme to C string conversion function. */
char *
scm_to_stringn (SCM str, size_t * lenp, const char *encoding,
- enum iconv_ilseq_handler handler)
+ scm_t_string_failed_conversion_handler handler)
{
static const char iso[11] = "ISO-8859-1";
char *buf;
@@ -1526,14 +1529,14 @@ scm_to_stringn (SCM str, size_t * lenp, const char
*encoding,
buf = NULL;
len = 0;
buf = u32_conv_to_encoding (iso,
- handler,
+ (enum iconv_ilseq_handler) handler,
(scm_t_uint32 *) scm_i_string_wide_chars (str),
ilen, NULL, NULL, &len);
if (buf == NULL)
scm_misc_error (NULL, "cannot convert to output locale ~s: \"~s\"",
scm_list_2 (scm_from_locale_string (iso), str));
- if (handler == iconveh_escape_sequence)
+ if (handler == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE)
unistring_escapes_to_guile_escapes (&buf, &len);
if (lenp)
diff --git a/libguile/strings.h b/libguile/strings.h
index 8c06e47..fe9162d 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;
+
SCM_API SCM scm_string_p (SCM x);
SCM_API SCM scm_string (SCM chrs);
SCM_API SCM scm_make_string (SCM k, SCM chr);
@@ -122,7 +130,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_API size_t scm_to_locale_stringbuf (SCM str, char *buf, size_t max_len);
SCM_API SCM scm_makfromstrs (int argc, char **argv);
diff --git a/test-suite/tests/strings.test b/test-suite/tests/strings.test
index d82a472..a35dd20 100644
--- a/test-suite/tests/strings.test
+++ b/test-suite/tests/strings.test
@@ -447,7 +447,17 @@
(string-set! s 4 (integer->char #x010300))
(char=? (string-ref s 4) (integer->char #x010300)))))
-
+;;
+;; list->string
+;;
+(with-test-prefix "string"
+
+ (pass-if-exception "convert circular list to string"
+ exception:wrong-type-arg
+ (let ((foo (list #\a #\b #\c)))
+ (set-cdr! (cddr foo) (cdr foo))
+ (apply string foo))))
+
(with-test-prefix "string-split"
;; in guile 1.6.7 and earlier, character >=128 wasn't matched in the string
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-1-64-geca29b0,
Michael Gran <=