[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-14-15-g8a
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-14-15-g8aa47f2 |
Date: |
Mon, 20 Dec 2010 23:51:06 +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=8aa47f26096ddb65d86c98e635ed550916525f0e
The branch, master has been updated
via 8aa47f26096ddb65d86c98e635ed550916525f0e (commit)
from 829ed325cf983e693f358caebbf352e79fc9f6d3 (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 8aa47f26096ddb65d86c98e635ed550916525f0e
Author: Ludovic Courtès <address@hidden>
Date: Tue Dec 21 00:18:20 2010 +0100
Have `lookahead-u8' and `get-u8' actually do binary input.
* libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_get_byte_or_eof'
instead of `scm_peek_char'.
(scm_get_u8): Likewise.
* test-suite/tests/r6rs-ports.test ("7.2.8 Binary
Input")["lookahead-u8"]: Fix typo.
["lookahead-u8 non-ASCII"]: New test.
-----------------------------------------------------------------------
Summary of changes:
libguile/r6rs-ports.c | 14 +++++++++-----
test-suite/tests/r6rs-ports.test | 26 +++++++++++++++++++-------
2 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c
index 232509c..8058ca0 100644
--- a/libguile/r6rs-ports.c
+++ b/libguile/r6rs-ports.c
@@ -433,7 +433,7 @@ SCM_DEFINE (scm_get_u8, "get-u8", 1, 0, 0,
SCM_VALIDATE_BINARY_INPUT_PORT (1, port);
- c_result = scm_getc (port);
+ c_result = scm_get_byte_or_eof (port);
if (c_result == EOF)
result = SCM_EOF_VAL;
else
@@ -449,15 +449,19 @@ SCM_DEFINE (scm_lookahead_u8, "lookahead-u8", 1, 0, 0,
"point past the octet.")
#define FUNC_NAME s_scm_lookahead_u8
{
+ int u8;
SCM result;
SCM_VALIDATE_BINARY_INPUT_PORT (1, port);
- result = scm_peek_char (port);
- if (SCM_CHARP (result))
- result = SCM_I_MAKINUM ((unsigned char) SCM_CHAR (result));
- else
+ u8 = scm_get_byte_or_eof (port);
+ if (u8 == EOF)
result = SCM_EOF_VAL;
+ else
+ {
+ scm_unget_byte (u8, port);
+ result = SCM_I_MAKINUM ((scm_t_uint8) u8);
+ }
return result;
}
diff --git a/test-suite/tests/r6rs-ports.test b/test-suite/tests/r6rs-ports.test
index 8d93f62..40bde08 100644
--- a/test-suite/tests/r6rs-ports.test
+++ b/test-suite/tests/r6rs-ports.test
@@ -1,7 +1,7 @@
-;;;; r6rs-ports.test --- R6RS I/O port tests. -*- coding: iso-8859-1; -*-
+;;;; r6rs-ports.test --- R6RS I/O port tests. -*- coding: utf-8; -*-
;;;;
;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
-;;;; Ludovic Courtès
+;;;; Ludovic Courtès
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -48,10 +48,22 @@
(pass-if "lookahead-u8"
(let ((port (open-input-string "A")))
(and (= (char->integer #\A) (lookahead-u8 port))
- (not (eof-object? port))
+ (= (char->integer #\A) (lookahead-u8 port))
(= (char->integer #\A) (get-u8 port))
(eof-object? (get-u8 port)))))
+ (pass-if "lookahead-u8 non-ASCII"
+ (let ((port (with-fluids ((%default-port-encoding "UTF-8"))
+ (open-input-string "λ"))))
+ (and (= 206 (lookahead-u8 port))
+ (= 206 (lookahead-u8 port))
+ (= 206 (get-u8 port))
+ (= 187 (lookahead-u8 port))
+ (= 187 (lookahead-u8 port))
+ (= 187 (get-u8 port))
+ (eof-object? (lookahead-u8 port))
+ (eof-object? (get-u8 port)))))
+
(pass-if "lookahead-u8: result is unsigned"
;; Bug #31081.
(let ((port (open-bytevector-input-port #vu8(255))))
@@ -501,7 +513,7 @@
(with-test-prefix "8.2.6 Input and output ports"
(pass-if "transcoded-port [output]"
- (let ((s "Hello\nÄÖÜ"))
+ (let ((s "Hello\nÃÃÃ"))
(bytevector=?
(string->utf8 s)
(call-with-bytevector-output-port
@@ -511,7 +523,7 @@
(put-string utf8-port s))))))))
(pass-if "transcoded-port [input]"
- (let ((s "Hello\nÄÖÜ"))
+ (let ((s "Hello\nÃÃÃ"))
(string=?
s
(get-string-all
@@ -519,9 +531,9 @@
(make-transcoder (utf-8-codec)))))))
(pass-if "transcoded-port [input line]"
- (string=? "ÄÖÜ"
+ (string=? "ÃÃÃ"
(get-line (transcoded-port
- (open-bytevector-input-port (string->utf8
"ÄÖÜ\nFooBar"))
+ (open-bytevector-input-port (string->utf8
"ÃÃÃ\nFooBar"))
(make-transcoder (utf-8-codec))))))
(pass-if "transcoded-port [error handling mode = raise]"
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-14-15-g8aa47f2,
Ludovic Courtès <=