[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-0-21-g0d6
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-0-21-g0d64634 |
Date: |
Mon, 22 Jun 2009 20:57:28 +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=0d646345f477f0ffced6f602370fc8c607f7d32f
The branch, master has been updated
via 0d646345f477f0ffced6f602370fc8c607f7d32f (commit)
from b674d4716abe775e648445795f02bece8a3396e0 (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 0d646345f477f0ffced6f602370fc8c607f7d32f
Author: Andy Wingo <address@hidden>
Date: Mon Jun 22 22:57:48 2009 +0200
flush whitespace from the repl input buffer *before* evaluation
* module/system/repl/repl.scm (start-repl): Given that the input port of
the repl is line-buffered, it's likely we have #\newline in the input
that is strictly extraneous, an in-band indicator to the repl that it
should begin reading now. So flush out that newline, so that you can
(read-char) at the repl, and it actually does wait for you to type in
a char instead of just returning #\newline.
While it's not an overriding concern, this does fix some brainfuck
programs that want to input from the user.
-----------------------------------------------------------------------
Summary of changes:
module/system/repl/repl.scm | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm
index 86fb56f..2f4a378 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -107,6 +107,9 @@
(newline)
(set! status '()))
(else
+ ;; since the input port is line-buffered, consume up to the
+ ;; newline
+ (flush-to-newline)
(with-backtrace
(catch 'quit
(lambda ()
@@ -134,3 +137,14 @@
((char-whitespace? ch) (read-char) (next-char wait))
(else ch)))
#f))
+
+(define (flush-to-newline)
+ (if (char-ready?)
+ (let ((ch (peek-char)))
+ (if (and (not (eof-object? ch)) (char-whitespace? ch))
+ (begin
+ (read-char)
+ (if (not (char=? ch #\newline))
+ (flush-to-newline)))))))
+
+
\ No newline at end of file
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-0-21-g0d64634,
Andy Wingo <=