guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-12-142-g3


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-12-142-g35c46aa
Date: Tue, 05 Oct 2010 17:55:05 +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=35c46aad664835e07ab0cb4a0d7f93632fb42f14

The branch, master has been updated
       via  35c46aad664835e07ab0cb4a0d7f93632fb42f14 (commit)
       via  fe78af419c9f4654677878a0904e71f96d5837b0 (commit)
       via  62651cb317c40ecb9f8257928f6f745ecb814747 (commit)
      from  78e836efffb3c1633c606447f29782e349f47747 (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 35c46aad664835e07ab0cb4a0d7f93632fb42f14
Author: Andy Wingo <address@hidden>
Date:   Tue Oct 5 19:58:13 2010 +0200

    system repl repl comments
    
    * module/system/repl/repl.scm (meta-reader): Add a comment about peek,
      read, and the EOF object.

commit fe78af419c9f4654677878a0904e71f96d5837b0
Author: Andy Wingo <address@hidden>
Date:   Tue Oct 5 19:55:37 2010 +0200

    bugfixes and simplifications to ice-9 buffered-input.
    
    * module/ice-9/buffered-input.scm (make-buffered-input-port): Simplify,
      and fix one case in which we would buffer the EOF object.

commit 62651cb317c40ecb9f8257928f6f745ecb814747
Author: Andy Wingo <address@hidden>
Date:   Tue Oct 5 19:38:21 2010 +0200

    guile-readline slight modernization
    
    * guile-readline/Makefile.am: Update to use am/guilec.
    
    * guile-readline/ice-9/readline.scm (activate-readline): Update to use a
      lambda*.

-----------------------------------------------------------------------

Summary of changes:
 guile-readline/Makefile.am        |   18 +++++++-------
 guile-readline/ice-9/readline.scm |    7 ++---
 module/ice-9/buffered-input.scm   |   46 ++++++++++++++++---------------------
 module/system/repl/repl.scm       |    5 ++-
 4 files changed, 35 insertions(+), 41 deletions(-)

diff --git a/guile-readline/Makefile.am b/guile-readline/Makefile.am
index e749ce8..f9d51a2 100644
--- a/guile-readline/Makefile.am
+++ b/guile-readline/Makefile.am
@@ -20,17 +20,18 @@
 ##   Floor, Boston, MA 02110-1301 USA
 
 include $(top_srcdir)/am/snarf
+include $(top_srcdir)/am/guilec
 
 ## Prevent automake from adding extra -I options
 DEFS = @DEFS@ @EXTRA_DEFS@
 
-if HAVE_READLINE
+# We're at the root of the module hierarchy.
+modpath =
+SOURCES =
 
-# `ice-9' subdirectory.
-ice9dir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)
-nobase_ice9_DATA = ice-9/readline.scm
-EXTRA_DIST = $(nobase_ice9_DATA)
+if HAVE_READLINE
 
+SOURCES += ice-9/readline.scm
 
 ## Check for headers in $(srcdir)/.., so that #include
 ## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
@@ -58,17 +59,16 @@ modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)
 modinclude_HEADERS = readline.h
 
 snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
-SUFFIXES = .x
+SUFFIXES += .x
 .c.x:
        $(AM_V_SNARF)$(GUILE_SNARF) -o $@ $< $(snarfcppopts)
 
 EXTRA_DIST += LIBGUILEREADLINE-VERSION ChangeLog-2008
 
-ETAGS_ARGS =                                                   \
-  $(nobase_ice9_DATA)                                          \
+ETAGS_ARGS +=                                                  \
   $(address@hidden@_la_SOURCES)
 
-CLEANFILES = *.x
+CLEANFILES += *.x
 
 endif HAVE_READLINE
 
diff --git a/guile-readline/ice-9/readline.scm 
b/guile-readline/ice-9/readline.scm
index b7aee91..38fb23f 100644
--- a/guile-readline/ice-9/readline.scm
+++ b/guile-readline/ice-9/readline.scm
@@ -205,7 +205,8 @@
       (let ((repl-read-hook (lambda () (run-hook before-read-hook))))
        (set-current-input-port (readline-port))
        (set! repl-reader
-             (lambda (repl-prompt . reader)
+             (lambda* (repl-prompt
+                        #:optional (reader (fluid-ref current-reader)))
                (let ((outer-new-input-prompt new-input-prompt)
                      (outer-continuation-prompt continuation-prompt)
                      (outer-read-hook read-hook))
@@ -214,9 +215,7 @@
                       (set-buffered-input-continuation?! (readline-port) #f)
                       (set-readline-prompt! repl-prompt "... ")
                       (set-readline-read-hook! repl-read-hook))
-                    (lambda () ((or (and (pair? reader) (car reader))
-                                    (fluid-ref current-reader)
-                                    read)))
+                    (lambda () ((or reader read) (current-input-port)))
                     (lambda ()
                       (set-readline-prompt! outer-new-input-prompt 
outer-continuation-prompt)
                       (set-readline-read-hook! outer-read-hook))))))
diff --git a/module/ice-9/buffered-input.scm b/module/ice-9/buffered-input.scm
index c35fdb8..56b1d87 100644
--- a/module/ice-9/buffered-input.scm
+++ b/module/ice-9/buffered-input.scm
@@ -1,6 +1,6 @@
 ;;;; buffered-input.scm --- construct a port from a buffered input reader
 ;;;;
-;;;;   Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+;;;;   Copyright (C) 2001, 2006, 2010 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
@@ -59,35 +59,29 @@ port when a new read operation starts, this data will be 
read before
 the first call to @var{reader}, and so @var{reader} will be called
 with @var{continuation?} set to @code{#t}."
   (let ((read-string "")
-       (string-index -1))
+       (string-index 0))
     (letrec ((get-character
              (lambda ()
-               (cond 
-                ((eof-object? read-string)
-                  (let ((eof read-string))
-                    (set! read-string "")
-                    (set! string-index -1)
-                    eof))
-                ((>= string-index (string-length read-string))
-                 (set! string-index -1)
-                  (get-character))
-                ((= string-index -1)
-                 (set! read-string (reader (buffered-input-continuation? 
port)))
-                  (set! string-index 0)
-                  (if (not (eof-object? read-string))
-                      (get-character)
-                      read-string))
-                (else
-                 (let ((res (string-ref read-string string-index)))
-                   (set! string-index (+ 1 string-index))
-                    (if (not (char-whitespace? res))
-                        (set! (buffered-input-continuation? port) #t))
-                   res)))))
+               (if (< string-index (string-length read-string))
+                    ;; Read a char.
+                    (let ((res (string-ref read-string string-index)))
+                      (set! string-index (+ 1 string-index))
+                      (if (not (char-whitespace? res))
+                          (set! (buffered-input-continuation? port) #t))
+                      res)
+                    ;; Fill the buffer.
+                    (let ((x (reader (buffered-input-continuation? port))))
+                      (cond
+                       ((eof-object? x)
+                        ;; Don't buffer the EOF object.
+                        x)
+                       (else
+                        (set! read-string x)
+                        (set! string-index 0)
+                        (get-character)))))))
             (input-waiting
              (lambda ()
-               (if (eof-object? read-string)
-                   1
-                   (- (string-length read-string) string-index))))
+                (- (string-length read-string) string-index)))
              (port #f))
       (set! port (make-soft-port (vector #f #f #f get-character #f 
input-waiting) "r"))
       (set! (buffered-input-continuation? port) #f)
diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm
index efe29ac..8275f8f 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -46,8 +46,9 @@
         (lambda ()
           (let ((ch (next-char #t)))
             (cond ((eof-object? ch)
-                   ;; apparently sometimes even if this is eof, read will
-                   ;; wait on somethingorother. strange.
+                   ;; EOF objects are not buffered. It's quite possible
+                   ;; to peek an EOF then read something else. It's
+                   ;; strange but it's how it works.
                    ch)
                   ((eqv? ch #\,)
                    (read-char port)


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]