This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Lately i noticed something funny in guile... guile> (define (test char) ... (with-input-from-string (make-string 1 char) ... (lambda () ... (let* ((peeked (peek-char)) ... (read (read-char))) ... (cons peeked read))))) guile> (test #\177) (#\ . #\) guile> (test #\200) (#\200 . #\-200) guile> (test #\377) (#\377 . #<eof>) R5RS requires that a peek-char followed by a read-char both return exactly the same value. The problem is the peek and read, since the behavior is the same on any port type, not only string ports. After a bit of diving into the ugly mess of guile ports, i think i found the problem in ports.h: struct scm_port_table { [...] char *cp; /* where to put and get unget chars */ char *cbufend; /* points after this struct */ char cbuf[SCM_INITIAL_CBUF_SIZE]; /* must be last: may grow */ }; The only fix i can see is to declare those buffers to be either unsigned char or int (int would be saner), and to adjust the accessing procedures and macros accordingly. I hope this helps, and keep up the good work, -forcer -- ((email . "forcer@mindless.com") (www . "http://webserver.de/forcer/") (irc . "forcer@#StarWars (IRCnet)") (pgp . "key available on my website"))