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-11-9-g9a5


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-11-9-g9a598c4
Date: Wed, 02 Jun 2010 20:50:35 +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=9a598c47f748c7369e622cdb491ee225b0b97767

The branch, master has been updated
       via  9a598c47f748c7369e622cdb491ee225b0b97767 (commit)
       via  3098986b1a1a2c43b2f40607497b08ff3034a8f9 (commit)
       via  4288533bb39f0bafc96efa2fe06e9ce62ba83166 (commit)
       via  3ece779a677d0316c506c30051a928ba40060479 (commit)
       via  749c2532e4c84c7bb1f40e2633ae47b99fd7322c (commit)
       via  bcec8c36996467433a17680e5a2ef27da2baecc5 (commit)
       via  c08adae4602e8aa2ac7d1d174292953f5a1ff2a7 (commit)
       via  4255e79fdab050064a9fbdf6ca88af41b23a8fdf (commit)
      from  22cf27c815b756cac6893b5b239898767e6cb498 (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 9a598c47f748c7369e622cdb491ee225b0b97767
Author: Andy Wingo <address@hidden>
Date:   Wed Jun 2 22:52:49 2010 +0200

    flesh out recursive repl module with local vars
    
    * module/system/vm/debug.scm (frame->module): Actually bind frame-local
      variables to values in the new anonymous module. Setting settable vars
      should work too :)

commit 3098986b1a1a2c43b2f40607497b08ff3034a8f9
Author: Andy Wingo <address@hidden>
Date:   Tue Jun 1 23:06:25 2010 +0200

    recursive repl support
    
    * module/system/repl/common.scm (*repl-level*): New public fluid.
      (repl-prompt): If *repl-level* is a positive integer, add it to the
      prompt.
    
    * module/system/repl/repl.scm (start-repl): The `lang' argument is now
      optional, and defaults to (current-language). New kwargs level and
      welcome; level defaults to 0, or 1+ the existing level, and the
      welcome is a boolean, true if level is 0. Parameterize *repl-level*
      during the dynamic extent of this repl. Also, parameterize
      the-last-stack to #f for the duration of this repl.
    
    * module/system/vm/debug.scm (frame->module, debugger-repl): Stubs of a
      recursive repl implementation. The idea is to be a repl in the lexical
      context of the error; but it would be nice to be able to operate in
      the module of the proc too, for example to export bindings. Hmm.

commit 4288533bb39f0bafc96efa2fe06e9ce62ba83166
Author: Andy Wingo <address@hidden>
Date:   Tue Jun 1 22:53:59 2010 +0200

    current-language fluid refactoring
    
    * module/system/base/compile.scm:
    * module/system/base/language.scm (*current-language*, current-language):
      Move this fluid and thunk down to (system base language).

commit 3ece779a677d0316c506c30051a928ba40060479
Author: Andy Wingo <address@hidden>
Date:   Tue Jun 1 22:20:57 2010 +0200

    boot-9 top-repl tweak
    
    * module/ice-9/boot-9.scm (top-repl): More concisely drill down to
      start-repl.

commit 749c2532e4c84c7bb1f40e2633ae47b99fd7322c
Author: Andy Wingo <address@hidden>
Date:   Tue Jun 1 22:18:24 2010 +0200

    some repl doc updates
    
    * doc/ref/tour.texi (Reporting Bugs): Update instructions for generating
      a backtrace.
    
    * doc/ref/scheme-using.texi: Update examples of Guile prompts, and add
      an explanation of the prompt format.

commit bcec8c36996467433a17680e5a2ef27da2baecc5
Author: Andy Wingo <address@hidden>
Date:   Tue Jun 1 22:02:06 2010 +0200

    minor NEWS tweaks
    
    * NEWS: Fix wordings.

commit c08adae4602e8aa2ac7d1d174292953f5a1ff2a7
Author: Andy Wingo <address@hidden>
Date:   Tue Jun 1 22:00:28 2010 +0200

    add #:version (6) to rnrs bytevectors and ports
    
    * module/rnrs/bytevectors.scm:
    * module/rnrs/io/ports.scm: Add #:version (6) to these modules.
    
    * module/6/rnrs.scm: Add versions to the import specs for bytevectors
      and ports.

commit 4255e79fdab050064a9fbdf6ca88af41b23a8fdf
Author: Andy Wingo <address@hidden>
Date:   Wed Jun 2 22:19:03 2010 +0200

    fix argument tab-completion
    
    * guile-readline/readline.c (scm_init_readline): Space is a
      word-breaking char too. Fixes tab-completion for args; thanks to Jao
      for the patch!

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

Summary of changes:
 NEWS                            |    6 ++--
 doc/ref/scheme-using.texi       |   29 +++++++++------
 doc/ref/tour.texi               |    2 +-
 guile-readline/readline.c       |    4 +-
 module/6/rnrs.scm               |    6 ++--
 module/ice-9/boot-9.scm         |    3 +-
 module/rnrs/bytevectors.scm     |    1 +
 module/rnrs/io/ports.scm        |    5 ++-
 module/system/base/compile.scm  |    6 ---
 module/system/base/language.scm |   16 ++++++++-
 module/system/repl/common.scm   |   11 ++++--
 module/system/repl/repl.scm     |   75 +++++++++++++++++++++------------------
 module/system/vm/debug.scm      |   31 ++++++++++++++++
 13 files changed, 125 insertions(+), 70 deletions(-)

diff --git a/NEWS b/NEWS
index 31fc943..1939a2b 100644
--- a/NEWS
+++ b/NEWS
@@ -132,7 +132,7 @@ module where the `library' macro is defined, not in the new 
module.
 
 `define-module', `use-modules', `export', and other such macros have
 been rewritten as hygienic macros. This allows the necessary referential
-transparency for the R6RS `library' for to do the right thing.
+transparency for the R6RS `library' form to do the right thing.
     
 ** Compiler and VM documentation updated
 
@@ -164,8 +164,8 @@ out!
 
 It was a little-known implementation detail of Guile's module system
 that it was built on a single hierarchical namespace of values -- that
-if there was a module named `(foo bar)', then there was a also module
-named `(foo)' with a binding from `bar' to the `(foo bar)' module.
+if there was a module named `(foo bar)', then in the module named
+`(foo)' there was a binding from `bar' to the `(foo bar)' module.
 
 This was a neat trick, but presented a number of problems. One problem
 was that the bindings in a module were not apparent from the module
diff --git a/doc/ref/scheme-using.texi b/doc/ref/scheme-using.texi
index 2e0a68f..c5667ae 100644
--- a/doc/ref/scheme-using.texi
+++ b/doc/ref/scheme-using.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C) 2006
address@hidden Copyright (C) 2006, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -14,11 +14,11 @@ Guile will evaluate them and print the results for you.  
Here are some
 simple examples.
 
 @lisp
-guile> (+ 3 4 5)
+scheme@@(guile-user)> (+ 3 4 5)
 12
-guile> (display "Hello world!\n")
+scheme@@(guile-user)> (display "Hello world!\n")
 Hello world!
-guile> (values 'a 'b)
+scheme@@(guile-user)> (values 'a 'b)
 a
 b
 @end lisp
@@ -29,6 +29,11 @@ This mode of use is called a @dfn{REPL}, which is short for
 expression that you have typed, then evaluates it, and then prints the
 result.
 
+The prompt shows you what language and module you are in. In this case, the
+current language is @code{scheme}, and the current module is
address@hidden(guile-user)}. @xref{Other Languages}, for more information on 
Guile's
+support for languages other than Scheme.
+
 @menu
 * Readline::
 * Value Historyx::
@@ -47,14 +52,14 @@ because of licensing reasons, but all you need to activate 
Readline is
 the following pair of lines.
 
 @lisp
-guile> (use-modules (ice-9 readline))
-guile> (activate-readline)
+scheme@@(guile-user)> (use-modules (ice-9 readline))
+scheme@@(guile-user)> (activate-readline)
 @end lisp
 
-It's a good idea to put these two lines (without the ``guile>''
+It's a good idea to put these two lines (without the ``scheme@@(guile-user)>''
 prompts) in your @file{.guile} file.  Guile reads this file when it
 starts up interactively, so anything in this file has the same effect
-as if you type it in by hand at the ``guile>'' prompt.
+as if you type it in by hand at the ``scheme@@(guile-user)>'' prompt.
 
 
 @node Value Historyx
@@ -68,13 +73,13 @@ variables @code{$1}, @code{$2}, @dots{}, and you can then 
use these
 variables in subsequent expressions.
 
 @lisp
-guile> (iota 10)
+scheme@@(guile-user)> (iota 10)
 $1 = (0 1 2 3 4 5 6 7 8 9)
-guile> (apply * (cdr $1))
+scheme@@(guile-user)> (apply * (cdr $1))
 $2 = 362880
-guile> (sqrt $2)
+scheme@@(guile-user)> (sqrt $2)
 $3 = 602.3952191045344
-guile> (cons $2 $1)
+scheme@@(guile-user)> (cons $2 $1)
 $4 = (362880 0 1 2 3 4 5 6 7 8 9)
 @end lisp
 
diff --git a/doc/ref/tour.texi b/doc/ref/tour.texi
index 4a1a483..3ccb4f2 100644
--- a/doc/ref/tour.texi
+++ b/doc/ref/tour.texi
@@ -399,7 +399,7 @@ If the manifestation of the bug is a Guile error message, 
it is
 important to report the precise text of the error message, and a
 backtrace showing how the Scheme program arrived at the error.
 
-This can be done using the procedure @code{backtrace} in the REPL.
+This can be done using the @code{backtrace} command in Guile's debugger.
 
 @item
 Check whether any programs you have loaded into Guile, including your
diff --git a/guile-readline/readline.c b/guile-readline/readline.c
index 2d3617d..13e7863 100644
--- a/guile-readline/readline.c
+++ b/guile-readline/readline.c
@@ -1,6 +1,6 @@
 /* readline.c --- line editing support for Guile */
 
-/* Copyright (C) 1997,1999,2000,2001, 2002, 2003, 2006, 2007, 2008, 2009 Free 
Software Foundation, Inc.
+/* Copyright (C) 1997,1999,2000,2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010 
Free Software Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -554,7 +554,7 @@ scm_init_readline ()
 #else  
   rl_completion_entry_function = (Function*) completion_function;
 #endif
-  rl_basic_word_break_characters = "\t\n\"'`;()";
+  rl_basic_word_break_characters = " \t\n\"'`;()";
   rl_readline_name = "Guile";
 
   reentry_barrier_mutex = scm_make_mutex ();
diff --git a/module/6/rnrs.scm b/module/6/rnrs.scm
index 8fb83e1..83fad98 100644
--- a/module/6/rnrs.scm
+++ b/module/6/rnrs.scm
@@ -218,8 +218,8 @@
          (rnrs arithmetic flonums (6))
          (rnrs base (6))
 
-         (rnrs bytevectors)
-
+         (rnrs bytevectors (6))
+          
          (rnrs conditions (6))
          (rnrs control (6))
          (rnrs enums (6))
@@ -227,7 +227,7 @@
          (rnrs files (6))
          (rnrs hashtables (6))
 
-         (rnrs io ports)
+         (rnrs io ports (6))
 
          (rnrs io simple (6))
          (rnrs lists (6))
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 5e6c441..c6b761f 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -3836,8 +3836,7 @@ module '(ice-9 q) '(make-q q-length))}."
     ;; scmsigs.c scm_sigaction_for_thread), so the handlers setup here have
     ;; no effect.
     (let ((old-handlers #f)
-          (start-repl (module-ref (resolve-interface '(system repl repl))
-                                  'start-repl))
+          (start-repl (@ (system repl repl) start-repl))
           (signals (if (provided? 'posix)
                        `((,SIGINT . "User interrupt")
                          (,SIGFPE . "Arithmetic error")
diff --git a/module/rnrs/bytevectors.scm b/module/rnrs/bytevectors.scm
index b33afe0..9744359 100644
--- a/module/rnrs/bytevectors.scm
+++ b/module/rnrs/bytevectors.scm
@@ -29,6 +29,7 @@
 ;;; Code:
 
 (define-module (rnrs bytevectors)
+  #:version (6)
   #:export-syntax (endianness)
   #:export (native-endianness bytevector?
            make-bytevector bytevector-length bytevector=? bytevector-fill!
diff --git a/module/rnrs/io/ports.scm b/module/rnrs/io/ports.scm
index 17d4907..89dc265 100644
--- a/module/rnrs/io/ports.scm
+++ b/module/rnrs/io/ports.scm
@@ -27,8 +27,9 @@
 ;;; Code:
 
 (define-module (rnrs io ports)
-  :re-export (eof-object? port? input-port? output-port?)
-  :export (eof-object
+  #:version (6)
+  #:re-export (eof-object? port? input-port? output-port?)
+  #:export (eof-object
 
            ;; input & output ports
            port-transcoder binary-port? transcoded-port
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index 71f768a..d553975 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -27,7 +27,6 @@
   #:use-module (ice-9 optargs)
   #:use-module (ice-9 receive)
   #:export (syntax-error 
-            *current-language*
             compiled-file-name
             compile-file
             compile-and-load
@@ -61,11 +60,6 @@
 ;;; Compiler
 ;;;
 
-(define *current-language* (make-fluid))
-(fluid-set! *current-language* 'scheme)
-(define (current-language)
-  (fluid-ref *current-language*))
-
 (define (call-once thunk)
   (let ((entered #f))
     (dynamic-wind
diff --git a/module/system/base/language.scm b/module/system/base/language.scm
index 8d02cd2..31e7708 100644
--- a/module/system/base/language.scm
+++ b/module/system/base/language.scm
@@ -28,7 +28,9 @@
             language-joiner language-make-default-environment
 
             lookup-compilation-order lookup-decompilation-order
-            invalidate-compilation-cache! default-environment))
+            invalidate-compilation-cache! default-environment
+
+            *current-language* current-language))
 
 
 ;;;
@@ -102,3 +104,15 @@
   "Return the default compilation environment for source language LANG."
   ((language-make-default-environment
     (if (language? lang) lang (lookup-language lang)))))
+
+
+
+;;;
+;;; Current language
+;;;
+
+(define *current-language* (make-fluid))
+(fluid-set! *current-language* 'scheme)
+
+(define (current-language)
+  (fluid-ref *current-language*))
diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index a106145..6901d32 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -29,7 +29,8 @@
             repl-welcome repl-prompt repl-read repl-compile repl-eval
             repl-parse repl-print repl-option-ref repl-option-set!
             puts ->string user-error
-            *warranty* *copying* *version*))
+            *warranty* *copying* *version*
+            *repl-level*))
 
 (define *version*
   (format #f "GNU Guile ~A
@@ -93,6 +94,8 @@ copy of the Program in return for a fee.
 
 See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
 
+(define *repl-level* (make-fluid))
+
 
 ;;;
 ;;; Repl type
@@ -118,8 +121,10 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more 
details.")
   (display "Enter `,help' for help.\n"))
 
 (define (repl-prompt repl)
-  (format #f "address@hidden> " (language-name (repl-language repl))
-          (module-name (current-module))))
+  (format #f "address@hidden> " (language-name (repl-language repl))
+          (module-name (current-module))
+          (let ((level (or (fluid-ref *repl-level*) 0)))
+            (if (zero? level) "" (format #f " [~a]" level)))))
 
 (define (repl-read repl)
   ((language-reader (repl-language repl)) (current-input-port)
diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm
index 8c54345..92f262c 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -1,6 +1,6 @@
 ;;; Read-Eval-Print Loop
 
-;; Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 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
@@ -92,42 +92,47 @@
 (define-macro (with-backtrace form)
   `(call-with-backtrace (lambda () ,form)))
 
-(define (start-repl lang)
+(define* (start-repl #:optional (lang (current-language)) #:key
+                     (level (1+ (or (fluid-ref *repl-level*) -1)))
+                     (welcome (equal? level 0)))
   (let ((repl (make-repl lang))
         (status #f))
-    (repl-welcome repl)
-    (let prompt-loop ()
-      (let ((exp (with-backtrace (prompting-meta-read repl))))
-        (cond
-         ((eqv? exp (if #f #f))) ; read error, pass
-         ((eq? exp meta-command-token)
-          (with-backtrace (meta-command repl)))
-         ((eof-object? exp)
-          (newline)
-          (set! status '()))
-         (else
-          ;; since the input port is line-buffered, consume up to the
-          ;; newline
-          (flush-to-newline)
-          (with-backtrace
-           (catch 'quit
-                  (lambda ()
-                    (call-with-values
-                        (lambda ()
-                          (run-hook before-eval-hook exp)
-                          (start-stack #t
-                                       (repl-eval repl (repl-parse repl exp))))
-                      (lambda l
-                        (for-each (lambda (v)
-                                    (run-hook before-print-hook v)
-                                    (repl-print repl v))
-                                  l))))
-                  (lambda (k . args)
-                    (set! status args))))))
-        (or status
-            (begin
-              (next-char #f) ;; consume trailing whitespace
-              (prompt-loop)))))))
+    (if welcome
+        (repl-welcome repl))
+    (with-fluids ((*repl-level* level)
+                  (the-last-stack #f))
+      (let prompt-loop ()
+        (let ((exp (with-backtrace (prompting-meta-read repl))))
+          (cond
+           ((eqv? exp (if #f #f)))      ; read error, pass
+           ((eq? exp meta-command-token)
+            (with-backtrace (meta-command repl)))
+           ((eof-object? exp)
+            (newline)
+            (set! status '()))
+           (else
+            ;; since the input port is line-buffered, consume up to the
+            ;; newline
+            (flush-to-newline)
+            (with-backtrace
+             (catch 'quit
+               (lambda ()
+                 (call-with-values
+                     (lambda ()
+                       (run-hook before-eval-hook exp)
+                       (start-stack #t
+                                    (repl-eval repl (repl-parse repl exp))))
+                   (lambda l
+                     (for-each (lambda (v)
+                                 (run-hook before-print-hook v)
+                                 (repl-print repl v))
+                               l))))
+               (lambda (k . args)
+                 (set! status args))))))
+          (or status
+              (begin
+                (next-char #f) ;; consume trailing whitespace
+                (prompt-loop))))))))
 
 (define (next-char wait)
   (if (or wait (char-ready?))
diff --git a/module/system/vm/debug.scm b/module/system/vm/debug.scm
index d5a4ac7..f330458 100644
--- a/module/system/vm/debug.scm
+++ b/module/system/vm/debug.scm
@@ -21,6 +21,7 @@
 (define-module (system vm debug)
   #:use-module (system base pmatch)
   #:use-module (system base syntax)
+  #:use-module (system base language)
   #:use-module (system vm vm)
   #:use-module (system vm frame)
   #:use-module (ice-9 rdelim)
@@ -139,6 +140,29 @@
                               #:per-line-prefix "     "))
             (lp (+ i inc) (or file last-file)))))))
 
+;; Ideally here we would have something much more syntactic, in that a set! to 
a
+;; local var that is not settable would raise an error, and export etc forms
+;; would modify the module in question: but alack, this is what we have now.
+;; Patches welcome!
+(define (frame->module frame)
+  (let ((proc (frame-procedure frame)))
+    (if (program? proc)
+        (let* ((mod (or (program-module proc) (current-module )))
+               (mod* (make-module)))
+          (module-use! mod* mod)
+          (for-each
+           (lambda (binding)
+             (module-add!
+              mod*
+              (binding:name binding)
+              (let ((x (frame-local-ref frame (binding:index binding))))
+                (if (binding:boxed? binding)
+                    x
+                    (make-variable x)))))
+           (frame-bindings frame))
+          mod*)
+        (current-module))))
+
 
 ;;;
 ;;; Debugger
@@ -289,6 +313,13 @@ With an argument, select a frame by index, then show it."
             (format #t "No such frame.~%"))))
          (else (show-frame))))
 
+      (define-command ((commands repl r))
+        "Run a new REPL in the context of the current frame."
+        (save-module-excursion
+         (lambda ()
+           (set-current-module (frame->module cur))
+           ((@ (system repl repl) start-repl)))))
+
       (define-command ((commands procedure proc))
         "Print the procedure for the selected frame."
         (print* (frame-procedure cur)))


hooks/post-receive
-- 
GNU Guile



reply via email to

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