[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile 2.0.9 build on mingw
From: |
Ludovic Courtès |
Subject: |
Re: guile 2.0.9 build on mingw |
Date: |
Tue, 18 Jun 2013 22:45:34 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Eli Zaretskii <address@hidden> skribis:
>> From: address@hidden (Ludovic Courtès)
>> Cc: address@hidden, address@hidden
>> Date: Sun, 16 Jun 2013 16:59:19 +0200
>>
>> > Running ports.test
>> > FAIL: ports.test: file: binary mode ignores port encoding
>> > FAIL: ports.test: file: binary mode ignores file coding declaration
>> >
>> > Should I worry about this?
>>
>> Possibly. :-)
>>
>> Can you try this patch, run ./check-guile ports.test, and report the
>> debugging statements that are printed?
>
> That pk thing is a useful trick, thanks.
>
> Btw, is there documentation anywhere about how to use the GDB
> interface functions in Guile? I sometimes need to display Scheme
> values while debugging, and I see there are functions for that, but I
> found no description of how they are supposed to be used. What am I
> missing?
There’s a gdbinit file in Guile that you can load to get a few helper
functions.
>> diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
>> index 9b1c6c0..6137181 100644
>> --- a/test-suite/tests/ports.test
>> +++ b/test-suite/tests/ports.test
>> @@ -251,7 +251,7 @@
>> (line (read-line in-port)))
>> (close-port in-port)
>> (delete-file filename)
>> - (string=? line binary-test-string)))))
>> + (string=? (pk 'line line) binary-test-string)))))
>>
>> ;;; binary mode ignores file coding declaration
>> (pass-if "file: binary mode ignores file coding declaration"
>> @@ -272,7 +272,7 @@
>> (line2 (read-line in-port)))
>> (close-port in-port)
>> (delete-file filename)
>> - (string=? line2 binary-test-string)))))
>> + (string=? (pk 'line2 line2) binary-test-string)))))
>>
>> ;; open-file ignores file coding declaration by default
>> (pass-if "file: open-file ignores coding declaration by default"
>
> It's due to the CRLF thing. These files are open in the "w" mode, but
> then read using the "rb" mode. So the CR character is left after the
> newline is stripped, and botches the comparison. The debug lines you
> added show this (note the \r at the end):
>
> ;;; (line "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\r")
> FAIL: ports.test: file: binary mode ignores port encoding
>
> ;;; (line2 "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\r")
> FAIL: ports.test: file: binary mode ignores file coding declaration
I think this patch solves the problem:
diff --git a/libguile/rdelim.c b/libguile/rdelim.c
index 9d14967..9f16c69 100644
--- a/libguile/rdelim.c
+++ b/libguile/rdelim.c
@@ -154,6 +154,7 @@ SCM_DEFINE (scm_read_line, "%read-line", 0, 1, 0,
{
case EOF:
case '\n':
+ case '\r':
delim = buf[index];
break;
Probably the extra case should be #ifdef __MINGW32__, to make sure it
has no effect on non-Windows users. Thoughts?
> I think the solution is to attach to the output port a transcoder that
> leaves the single newline character at end of line intact. But I
> couldn't find any example or documentation that would show me how to
> construct a transcoder for an encoding. make-transcoder wants a
> codec, but I see no documentation how to make one. IOW, how do I take
> a string like "iso-8859-15" and make a codec out of it? I trust that
> you will know, though ;-)
Ah ah, this is an R6RS API that’s not actually fully implemented.
So, there are predefined codecs, like ‘latin-1-codec’. This part is
implemented, in terms of ‘set-port-encoding!’.
However the CR/LF transcoders are not implemented.
Ludo’.
- Re: guile 2.0.9 build on mingw, (continued)
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/16
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/13
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/17
- Re: guile 2.0.9 build on mingw,
Ludovic Courtès <=
- Re: guile 2.0.9 build on mingw, Mark H Weaver, 2013/06/18
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/18
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/19
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/19
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/18
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/19
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/19
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/13
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/16