Fluidize *unparse...*, i.e. *unparser-table*, *unparser-radix*...
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Sun, 2 Feb 2014 21:39:38 +0000 (14:39 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Tue, 12 Aug 2014 00:30:28 +0000 (17:30 -0700)
... *unparse-abbreviate-quotations?*,
    *unparse-compound-procedure-names?*,
    *unparse-primitives-by-name?*,
    *unparse-uninterned-symbols-by-name?*,
    *unparse-with-datum?*,
    *unparse-with-maximum-readability?*,
    *unparser-list-breadth-limit*,
    *unparser-list-depth-limit*, and
    *unparser-string-length-limit*.

31 files changed:
doc/ref-manual/io.texi
src/6001/nodefs.scm
src/compiler/base/debug.scm
src/compiler/base/object.scm
src/compiler/base/toplev.scm
src/compiler/machines/alpha/dassm1.scm
src/compiler/machines/bobcat/dassm1.scm
src/compiler/machines/i386/dassm1.scm
src/compiler/machines/mips/dassm1.scm
src/compiler/machines/spectrum/dassm1.scm
src/compiler/machines/svm/disassembler.scm
src/compiler/machines/vax/dassm1.scm
src/compiler/machines/x86-64/dassm1.scm
src/edwin/artdebug.scm
src/edwin/debug.scm
src/edwin/evlcom.scm
src/edwin/intmod.scm
src/edwin/prompt.scm
src/edwin/schmod.scm
src/runtime/boot.scm
src/runtime/debug.scm
src/runtime/error.scm
src/runtime/pp.scm
src/runtime/rep.scm
src/runtime/stack-sample.scm
src/runtime/swank.scm
src/runtime/unpars.scm
src/sf/cgen.scm
src/sicp/compat.scm
src/swat/scheme/other/rtest.scm
tests/unit-testing.scm

index e2246174e461102241c6e6e57c66bcdc7a96adfe..e36982518c9261b51f17088d4a902b7d5cad6e7a 100644 (file)
@@ -882,74 +882,80 @@ The following variables may be dynamically bound to change the behavior
 of the @code{write} and @code{display} procedures.
 
 @defvr variable *unparser-radix*
-This variable specifies the default radix used to print numbers.  Its
+This fluid specifies the default radix used to print numbers.  Its
 value must be one of the exact integers @code{2}, @code{8}, @code{10},
 or @code{16}; the default is @code{10}.  If @code{*unparser-radix*} is
 not @code{10}, numbers are prefixed to indicate their radix.
 @end defvr
 
 @defvr variable *unparser-list-breadth-limit*
-This variable specifies a limit on the length of the printed
+This fluid specifies a limit on the length of the printed
 representation of a list or vector; for example, if the limit is
 @code{4}, only the first four elements of any list are printed, followed
 by ellipses to indicate any additional elements.  The value of this
-variable must be an exact non-negative integer, or @code{#f} meaning no
+fluid must be an exact non-negative integer, or @code{#f} meaning no
 limit; the default is @code{#f}.
 
 @example
 @group
-(fluid-let ((*unparser-list-breadth-limit* 4))
-  (write-to-string '(a b c d)))
+(let-fluid *unparser-list-breadth-limit* 4
+  (lambda ()
+    (write-to-string '(a b c d))))
                                 @result{} "(a b c d)"
-(fluid-let ((*unparser-list-breadth-limit* 4))
-  (write-to-string '(a b c d e)))
+(let-fluid *unparser-list-breadth-limit* 4
+  (lambda ()
+    (write-to-string '(a b c d e))))
                                 @result{} "(a b c d ...)"
 @end group
 @end example
 @end defvr
 
 @defvr variable *unparser-list-depth-limit*
-This variable specifies a limit on the nesting of lists and vectors in
+This fluid specifies a limit on the nesting of lists and vectors in
 the printed representation.  If lists (or vectors) are more deeply
 nested than the limit, the part of the representation that exceeds the
-limit is replaced by ellipses.  The value of this variable must be an
+limit is replaced by ellipses.  The value of this fluid must be an
 exact non-negative integer, or @code{#f} meaning no limit; the default
 is @code{#f}.
 
 @example
 @group
-(fluid-let ((*unparser-list-depth-limit* 4))
-  (write-to-string '((((a))) b c d)))
+(let-fluid *unparser-list-depth-limit* 4
+  (lambda ()
+    (write-to-string '((((a))) b c d))))
                                 @result{} "((((a))) b c d)"
-(fluid-let ((*unparser-list-depth-limit* 4))
-  (write-to-string '(((((a)))) b c d)))
+(let-fluid *unparser-list-depth-limit* 4
+  (lambda ()
+    (write-to-string '(((((a)))) b c d))))
                                 @result{} "((((...))) b c d)"
 @end group
 @end example
 @end defvr
 
 @defvr variable *unparser-string-length-limit*
-This variable specifies a limit on the length of the printed
+This fluid specifies a limit on the length of the printed
 representation of strings.  If a string's length exceeds this limit, the
 part of the printed representation for the characters exceeding the
-limit is replaced by ellipses.  The value of this variable must be an
+limit is replaced by ellipses.  The value of this fluid must be an
 exact non-negative integer, or @code{#f} meaning no limit; the default
 is @code{#f}.
 
 @example
 @group
-(fluid-let ((*unparser-string-length-limit* 4))
-  (write-to-string "abcd"))
+(let-fluid *unparser-string-length-limit* 4
+  (lambda ()
+    (write-to-string "abcd")))
                                 @result{} "\"abcd\""
-(fluid-let ((*unparser-string-length-limit* 4))
-  (write-to-string "abcde"))
+(let-fluid *unparser-string-length-limit* 4
+  (lambda ()
+    (write-to-string "abcde")))
                                 @result{} "\"abcd...\""
 @end group
 @end example
 @end defvr
 
 @defvr variable *unparse-with-maximum-readability?*
-This variable, which takes a boolean value, tells the printer to use a
+This fluid, which takes a boolean value, tells the printer to use a
 special printed representation for objects that normally print in a form
 that cannot be recognized by @code{read}.  These objects are printed
 using the representation @code{#@@@var{n}}, where @var{n} is the result
index dbb4fcabfb8dda3983ceb1f33c921442ef75cd94..04884beee9f3d3ca76cc778af161ea509a7d44af 100644 (file)
@@ -77,7 +77,8 @@ USA.
      (if (not (default-object? value))
         (begin
           (write-string " --> " port)
-          (fluid-let ((*unparser-list-depth-limit* 2)
-                      (*unparser-list-breadth-limit* 10)
-                      (*unparser-string-length-limit* 30))
-            (write value port)))))))
\ No newline at end of file
+          (let-fluids *unparser-list-depth-limit* 2
+                      *unparser-list-breadth-limit* 10
+                      *unparser-string-length-limit* 30
+            (lambda ()
+              (write value port))))))))
index 7a0e5ce470f43fecd0b50ad6d2e7e93a72b3481b..114b8c8fa5a1151884b86e8c71b05de0cbe0b372 100644 (file)
@@ -104,17 +104,17 @@ USA.
   (newline))
 
 (define (write-instructions thunk)
-  (fluid-let ((*show-instruction* write)
-             (*unparser-radix* 16)
-             (*unparse-uninterned-symbols-by-name?* #t))
-    (thunk)))
+  (fluid-let ((*show-instruction* write))
+    (let-fluids *unparser-radix* 16
+               *unparse-uninterned-symbols-by-name?* #t
+      thunk)))
 
 (define (pp-instructions thunk)
   (fluid-let ((*show-instruction* pretty-print)
-             (*pp-primitives-by-name* #f)
-             (*unparser-radix* 16)
-             (*unparse-uninterned-symbols-by-name?* #t))
-    (thunk)))
+             (*pp-primitives-by-name* #f))
+    (let-fluids *unparser-radix* 16
+               *unparse-uninterned-symbols-by-name?* #t
+      thunk)))
 
 (define *show-instruction*)
 
index 7886cca6f48fabfdd6e9ccc81883a53699bd1e00..e5d5ed3398bc9b6c26c7dbc4290363b8c5d02f08 100644 (file)
@@ -156,5 +156,6 @@ USA.
        (unparser/standard-method name))))
 
 (define (tagged-vector/unparse state vector)
-  (fluid-let ((*unparser-radix* 16))
-    ((tagged-vector/unparser vector) state vector)))
\ No newline at end of file
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      ((tagged-vector/unparser vector) state vector))))
index 4c88a098b12f35d92dd1b8eab9e5893da47da92c..c1a94708c192a0ba3ef6ab9d7ba71caea7ee04c7 100644 (file)
@@ -1055,41 +1055,42 @@ USA.
 (define (phase/lap-file-output scode port)
   (compiler-phase "LAP File Output"
     (lambda ()
-      (fluid-let ((*unparser-radix* 16)
-                 (*unparse-uninterned-symbols-by-name?* #t))
-       (with-output-to-port port
-         (lambda ()
-           (write-string "LAP for object ")
-           (write *recursive-compilation-number*)
-           (newline)
-           (pp scode (current-output-port) #t 4)
-           (newline)
-           (newline)
-           (newline)
-           (for-each
-               (lambda (instruction)
-                 (cond ((and (pair? instruction)
-                             (eq? (car instruction) 'LABEL))
-                        (write (cadr instruction))
-                        (write-char #\:))
-                       ((and (pair? instruction)
-                             (eq? (car instruction) 'COMMENT))
-                        (write-char #\tab)
-                        (write-string ";;")
-                        (for-each (lambda (frob)
-                                    (write-string " ")
-                                    (write (if (and (pair? frob)
-                                                    (eq? (car frob) 'RTL))
-                                               (cadr frob)
-                                               frob)))
-                          (cdr instruction)))
-                       (else
-                        (write-char #\tab)
-                        (write instruction)))
-                 (newline))
-             *lap*)
-           (if (not (zero? *recursive-compilation-number*))
-               (begin
-                 (write-char #\page)
-                 (newline)))
-           (output-port/flush-output port)))))))
\ No newline at end of file
+      (let-fluids *unparser-radix* 16
+                 *unparse-uninterned-symbols-by-name?* #t
+        (lambda ()
+         (with-output-to-port port
+           (lambda ()
+             (write-string "LAP for object ")
+             (write *recursive-compilation-number*)
+             (newline)
+             (pp scode (current-output-port) #t 4)
+             (newline)
+             (newline)
+             (newline)
+             (for-each
+                 (lambda (instruction)
+                   (cond ((and (pair? instruction)
+                               (eq? (car instruction) 'LABEL))
+                          (write (cadr instruction))
+                          (write-char #\:))
+                         ((and (pair? instruction)
+                               (eq? (car instruction) 'COMMENT))
+                          (write-char #\tab)
+                          (write-string ";;")
+                          (for-each (lambda (frob)
+                                      (write-string " ")
+                                      (write (if (and (pair? frob)
+                                                      (eq? (car frob) 'RTL))
+                                                 (cadr frob)
+                                                 frob)))
+                            (cdr instruction)))
+                         (else
+                          (write-char #\tab)
+                          (write instruction)))
+                   (newline))
+               *lap*)
+             (if (not (zero? *recursive-compilation-number*))
+                 (begin
+                   (write-char #\page)
+                   (newline)))
+             (output-port/flush-output port))))))))
index ff8958cd94076309babb24b09269aea571a7e547..3b5a5c9e843f7fcbaec13d6e90c9734cb9883fbc 100644 (file)
@@ -131,12 +131,13 @@ USA.
   (disassembler/instructions false start-address end-address false))
 
 (define (disassembler/write-instruction-stream symbol-table instruction-stream)
-  (fluid-let ((*unparser-radix* 16))
-    (disassembler/for-each-instruction instruction-stream
-      (lambda (offset instruction)
-       (disassembler/write-instruction symbol-table
-                                       offset
-                                       (lambda () (display instruction)))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (disassembler/for-each-instruction instruction-stream
+       (lambda (offset instruction)
+         (disassembler/write-instruction symbol-table
+                                         offset
+           (lambda () (display instruction))))))))
 
 (define (disassembler/for-each-instruction instruction-stream procedure)
   (let loop ((instruction-stream instruction-stream))
@@ -147,29 +148,30 @@ USA.
            (loop (instruction-stream)))))))
 \f
 (define (disassembler/write-constants-block block symbol-table)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (system-vector-length block)))
-      (let loop ((index (compiled-code-block/constants-start block)))
-       (cond ((not (< index end)) 'DONE)
-             ((object-type?
-               ((sc-macro-transformer
-                 (lambda (form environment)
-                   environment
-                   (apply microcode-type (cdr form))))
-                linkage-section)
-               (system-vector-ref block index))
-              (loop (disassembler/write-linkage-section block
-                                                        symbol-table
-                                                        index)))
-             (else
-              (disassembler/write-instruction
-               symbol-table
-               (compiled-code-block/index->offset index)
-               (lambda ()
-                 (write-constant block
-                                 symbol-table
-                                 (system-vector-ref block index))))
-              (loop (1+ index))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (system-vector-length block)))
+       (let loop ((index (compiled-code-block/constants-start block)))
+         (cond ((not (< index end)) 'DONE)
+               ((object-type?
+                 ((sc-macro-transformer
+                   (lambda (form environment)
+                     environment
+                     (apply microcode-type (cdr form))))
+                  linkage-section)
+                 (system-vector-ref block index))
+                (loop (disassembler/write-linkage-section block
+                                                          symbol-table
+                                                          index)))
+               (else
+                (disassembler/write-instruction
+                 symbol-table
+                 (compiled-code-block/index->offset index)
+                 (lambda ()
+                   (write-constant block
+                                   symbol-table
+                                   (system-vector-ref block index))))
+                (loop (1+ index)))))))))
 
 (define (write-constant block symbol-table constant)
   (write-string (cdr (write-to-string constant 60)))
index b12392d3ed3cd00fea286be076e474d80805013b..5e1bbb5c9039e509f33c6c5c57dd0fb1292d3ec6 100644 (file)
@@ -117,12 +117,13 @@ USA.
   (disassembler/instructions false start-address end-address false))
 
 (define (disassembler/write-instruction-stream symbol-table instruction-stream)
-  (fluid-let ((*unparser-radix* 16))
-    (disassembler/for-each-instruction instruction-stream
-      (lambda (offset instruction)
-       (disassembler/write-instruction symbol-table
-                                       offset
-                                       (lambda () (display instruction)))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (disassembler/for-each-instruction instruction-stream
+       (lambda (offset instruction)
+         (disassembler/write-instruction symbol-table
+                                         offset
+           (lambda () (display instruction))))))))
 
 (define (disassembler/for-each-instruction instruction-stream procedure)
   (let loop ((instruction-stream instruction-stream))
@@ -133,30 +134,31 @@ USA.
            (loop (instruction-stream)))))))
 \f
 (define (disassembler/write-constants-block block symbol-table)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (system-vector-length block)))
-      (let loop ((index (compiled-code-block/constants-start block)))
-       (cond ((not (< index end)) 'DONE)
-             ((object-type?
-               (let-syntax ((ucode-type
-                             (sc-macro-transformer
-                              (lambda (form environment)
-                                environment
-                                (apply microcode-type (cdr form))))))
-                 (ucode-type linkage-section))
-               (system-vector-ref block index))
-              (loop (disassembler/write-linkage-section block
-                                                        symbol-table
-                                                        index)))
-             (else
-              (disassembler/write-instruction
-               symbol-table
-               (compiled-code-block/index->offset index)
-               (lambda ()
-                 (write-constant block
-                                 symbol-table
-                                 (system-vector-ref block index))))
-              (loop (1+ index))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (system-vector-length block)))
+       (let loop ((index (compiled-code-block/constants-start block)))
+         (cond ((not (< index end)) 'DONE)
+               ((object-type?
+                 (let-syntax ((ucode-type
+                               (sc-macro-transformer
+                                (lambda (form environment)
+                                  environment
+                                  (apply microcode-type (cdr form))))))
+                   (ucode-type linkage-section))
+                 (system-vector-ref block index))
+                (loop (disassembler/write-linkage-section block
+                                                          symbol-table
+                                                          index)))
+               (else
+                (disassembler/write-instruction
+                 symbol-table
+                 (compiled-code-block/index->offset index)
+                 (lambda ()
+                   (write-constant block
+                                   symbol-table
+                                   (system-vector-ref block index))))
+                (loop (1+ index)))))))))
 
 (define (write-constant block symbol-table constant)
   (write-string (cdr (write-to-string constant 60)))
index c259fc3884d3bafd7a33186cf8e03f8d57f87dff..1d4fee559ef4635a0e2ba7b6f80e2af43bf04d0d 100644 (file)
@@ -117,22 +117,23 @@ USA.
   (disassembler/instructions #f start-address end-address #f))
 
 (define (disassembler/write-instruction-stream symbol-table instruction-stream)
-  (fluid-let ((*unparser-radix* 16))
-    (disassembler/for-each-instruction instruction-stream
-      (lambda (offset instruction comment)
-       (disassembler/write-instruction
-        symbol-table
-        offset
-        (lambda ()
-          (if comment
-              (let ((s (with-output-to-string
-                         (lambda () (display instruction)))))
-                (if (< (string-length s) 40)
-                    (write-string (string-pad-right s 40))
-                    (write-string s))
-                (write-string "; ")
-                (display comment))
-              (write instruction))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (disassembler/for-each-instruction instruction-stream
+       (lambda (offset instruction comment)
+         (disassembler/write-instruction
+          symbol-table
+          offset
+          (lambda ()
+            (if comment
+                (let ((s (with-output-to-string
+                           (lambda () (display instruction)))))
+                  (if (< (string-length s) 40)
+                      (write-string (string-pad-right s 40))
+                      (write-string s))
+                  (write-string "; ")
+                  (display comment))
+                (write instruction)))))))))
 
 (define (disassembler/for-each-instruction instruction-stream procedure)
   (let loop ((instruction-stream instruction-stream))
@@ -143,30 +144,31 @@ USA.
            (loop (instruction-stream)))))))
 \f
 (define (disassembler/write-constants-block block symbol-table)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (system-vector-length block)))
-      (let loop ((index (compiled-code-block/marked-start block)))
-       (cond ((not (< index end)) 'DONE)
-             ((object-type?
-               (let-syntax ((ucode-type
-                             (sc-macro-transformer
-                              (lambda (form environment)
-                                environment
-                                (apply microcode-type (cdr form))))))
-                 (ucode-type linkage-section))
-               (system-vector-ref block index))
-              (loop (disassembler/write-linkage-section block
-                                                        symbol-table
-                                                        index)))
-             (else
-              (disassembler/write-instruction
-               symbol-table
-               (compiled-code-block/index->offset index)
-               (lambda ()
-                 (write-constant block
-                                 symbol-table
-                                 (system-vector-ref block index))))
-              (loop (1+ index))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (system-vector-length block)))
+       (let loop ((index (compiled-code-block/marked-start block)))
+         (cond ((not (< index end)) 'DONE)
+               ((object-type?
+                 (let-syntax ((ucode-type
+                               (sc-macro-transformer
+                                (lambda (form environment)
+                                  environment
+                                  (apply microcode-type (cdr form))))))
+                   (ucode-type linkage-section))
+                 (system-vector-ref block index))
+                (loop (disassembler/write-linkage-section block
+                                                          symbol-table
+                                                          index)))
+               (else
+                (disassembler/write-instruction
+                 symbol-table
+                 (compiled-code-block/index->offset index)
+                 (lambda ()
+                   (write-constant block
+                                   symbol-table
+                                   (system-vector-ref block index))))
+                (loop (1+ index)))))))))
 
 (define (write-constant block symbol-table constant)
   (write-string (cdr (write-to-string constant 60)))
index b12392d3ed3cd00fea286be076e474d80805013b..5e1bbb5c9039e509f33c6c5c57dd0fb1292d3ec6 100644 (file)
@@ -117,12 +117,13 @@ USA.
   (disassembler/instructions false start-address end-address false))
 
 (define (disassembler/write-instruction-stream symbol-table instruction-stream)
-  (fluid-let ((*unparser-radix* 16))
-    (disassembler/for-each-instruction instruction-stream
-      (lambda (offset instruction)
-       (disassembler/write-instruction symbol-table
-                                       offset
-                                       (lambda () (display instruction)))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (disassembler/for-each-instruction instruction-stream
+       (lambda (offset instruction)
+         (disassembler/write-instruction symbol-table
+                                         offset
+           (lambda () (display instruction))))))))
 
 (define (disassembler/for-each-instruction instruction-stream procedure)
   (let loop ((instruction-stream instruction-stream))
@@ -133,30 +134,31 @@ USA.
            (loop (instruction-stream)))))))
 \f
 (define (disassembler/write-constants-block block symbol-table)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (system-vector-length block)))
-      (let loop ((index (compiled-code-block/constants-start block)))
-       (cond ((not (< index end)) 'DONE)
-             ((object-type?
-               (let-syntax ((ucode-type
-                             (sc-macro-transformer
-                              (lambda (form environment)
-                                environment
-                                (apply microcode-type (cdr form))))))
-                 (ucode-type linkage-section))
-               (system-vector-ref block index))
-              (loop (disassembler/write-linkage-section block
-                                                        symbol-table
-                                                        index)))
-             (else
-              (disassembler/write-instruction
-               symbol-table
-               (compiled-code-block/index->offset index)
-               (lambda ()
-                 (write-constant block
-                                 symbol-table
-                                 (system-vector-ref block index))))
-              (loop (1+ index))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (system-vector-length block)))
+       (let loop ((index (compiled-code-block/constants-start block)))
+         (cond ((not (< index end)) 'DONE)
+               ((object-type?
+                 (let-syntax ((ucode-type
+                               (sc-macro-transformer
+                                (lambda (form environment)
+                                  environment
+                                  (apply microcode-type (cdr form))))))
+                   (ucode-type linkage-section))
+                 (system-vector-ref block index))
+                (loop (disassembler/write-linkage-section block
+                                                          symbol-table
+                                                          index)))
+               (else
+                (disassembler/write-instruction
+                 symbol-table
+                 (compiled-code-block/index->offset index)
+                 (lambda ()
+                   (write-constant block
+                                   symbol-table
+                                   (system-vector-ref block index))))
+                (loop (1+ index)))))))))
 
 (define (write-constant block symbol-table constant)
   (write-string (cdr (write-to-string constant 60)))
index 72caaa052a3bdf4f2223c5b6cff370fdc64a6b8e..e3a9647d31fabbb7afa38b401fbd0b0449a221d5 100644 (file)
@@ -117,12 +117,13 @@ USA.
   (disassembler/instructions false start-address end-address false))
 
 (define (disassembler/write-instruction-stream symbol-table instruction-stream)
-  (fluid-let ((*unparser-radix* 16))
-    (disassembler/for-each-instruction instruction-stream
-      (lambda (offset instruction)
-       (disassembler/write-instruction symbol-table
-                                       offset
-                                       (lambda () (display instruction)))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (disassembler/for-each-instruction instruction-stream
+       (lambda (offset instruction)
+         (disassembler/write-instruction symbol-table
+                                         offset
+           (lambda () (display instruction))))))))
 
 (define (disassembler/for-each-instruction instruction-stream procedure)
   (let loop ((instruction-stream instruction-stream))
@@ -133,30 +134,31 @@ USA.
            (loop (instruction-stream)))))))
 \f
 (define (disassembler/write-constants-block block symbol-table)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (system-vector-length block)))
-      (let loop ((index (compiled-code-block/constants-start block)))
-       (cond ((not (< index end)) 'DONE)
-             ((object-type?
-               (let-syntax ((ucode-type
-                             (sc-macro-transformer
-                              (lambda (form environment)
-                                environment
-                                (apply microcode-type (cdr form))))))
-                 (ucode-type linkage-section))
-               (system-vector-ref block index))
-              (loop (disassembler/write-linkage-section block
-                                                        symbol-table
-                                                        index)))
-             (else
-              (disassembler/write-instruction
-               symbol-table
-               (compiled-code-block/index->offset index)
-               (lambda ()
-                 (write-constant block
-                                 symbol-table
-                                 (system-vector-ref block index))))
-              (loop (1+ index))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (system-vector-length block)))
+       (let loop ((index (compiled-code-block/constants-start block)))
+         (cond ((not (< index end)) 'DONE)
+               ((object-type?
+                 (let-syntax ((ucode-type
+                               (sc-macro-transformer
+                                (lambda (form environment)
+                                  environment
+                                  (apply microcode-type (cdr form))))))
+                   (ucode-type linkage-section))
+                 (system-vector-ref block index))
+                (loop (disassembler/write-linkage-section block
+                                                          symbol-table
+                                                          index)))
+               (else
+                (disassembler/write-instruction
+                 symbol-table
+                 (compiled-code-block/index->offset index)
+                 (lambda ()
+                   (write-constant block
+                                   symbol-table
+                                   (system-vector-ref block index))))
+                (loop (1+ index)))))))))
 
 (define (write-constant block symbol-table constant)
   (write-string (cdr (write-to-string constant 60)))
index 30c37cbb7aad66cce133a62cc273fa34ea676a07..c958b66008ee3294e5e2bc4cb4e718e5313b98a3 100644 (file)
@@ -110,13 +110,14 @@ USA.
     (make-cursor block start symbol-table)))
 
 (define (write-instructions cursor)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (compiled-code-block/code-end (cursor-block cursor))))
-      (let loop ()
-       (if (< (cursor-offset cursor) end)
-           (begin
-             (write-instruction cursor)
-             (loop)))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (compiled-code-block/code-end (cursor-block cursor))))
+       (let loop ()
+         (if (< (cursor-offset cursor) end)
+             (begin
+               (write-instruction cursor)
+               (loop))))))))
 
 (define (write-instruction cursor)
   (write-offset cursor)
@@ -218,27 +219,28 @@ USA.
               #t)))))
 \f
 (define (write-constants cursor)
-  (fluid-let ((*unparser-radix* 16))
-    (let* ((block (cursor-block cursor))
-          (end (compiled-code-block/index->offset
-                (system-vector-length block))))
-
-      (assert (= (cursor-offset cursor)
-                (* (1+ (compiled-code-block/marked-start block))
-                   address-units-per-object)))
-      (let loop ()
-       (let ((offset (cursor-offset cursor)))
-         (if (< offset end)
-             (let ((object (system-vector-ref
-                            block (compiled-code-block/offset->index offset))))
-               (if (object-type? (ucode-type linkage-section) object)
-                   (write-linkage-section object cursor)
-                   (begin
-                     (write-offset cursor)
-                     (write-constant object cursor)
-                     (set-cursor-offset! cursor
-                                         (+ offset address-units-per-object))))
-               (loop))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let* ((block (cursor-block cursor))
+            (end (compiled-code-block/index->offset
+                  (system-vector-length block))))
+
+       (assert (= (cursor-offset cursor)
+                  (* (1+ (compiled-code-block/marked-start block))
+                     address-units-per-object)))
+       (let loop ()
+         (let ((offset (cursor-offset cursor)))
+           (if (< offset end)
+               (let ((object (system-vector-ref
+                              block (compiled-code-block/offset->index offset))))
+                 (if (object-type? (ucode-type linkage-section) object)
+                     (write-linkage-section object cursor)
+                     (begin
+                       (write-offset cursor)
+                       (write-constant object cursor)
+                       (set-cursor-offset! cursor
+                                           (+ offset address-units-per-object))))
+                 (loop)))))))))
 
 (define (write-constant constant cursor)
   (write-string (cdr (write-to-string constant 60)))
index d04f84a24877756993bb7bed47a32ef80611b292..739c5f4d54f51ee32cac23c1ebb040fbd24ba6a0 100644 (file)
@@ -105,12 +105,13 @@ USA.
   (disassembler/instructions false start-address end-address false))
 
 (define (disassembler/write-instruction-stream symbol-table instruction-stream)
-  (fluid-let ((*unparser-radix* 16))
-    (disassembler/for-each-instruction instruction-stream
-      (lambda (offset instruction)
-       (disassembler/write-instruction symbol-table
-                                       offset
-                                       (lambda () (display instruction)))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (disassembler/for-each-instruction instruction-stream
+       (lambda (offset instruction)
+         (disassembler/write-instruction symbol-table
+                                         offset
+           (lambda () (display instruction))))))))
 
 (define (disassembler/for-each-instruction instruction-stream procedure)
   (let loop ((instruction-stream instruction-stream))
@@ -121,30 +122,31 @@ USA.
            (loop (instruction-stream)))))))
 \f
 (define (disassembler/write-constants-block block symbol-table)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (system-vector-length block)))
-      (let loop ((index (compiled-code-block/constants-start block)))
-       (cond ((not (< index end)) 'DONE)
-             ((object-type?
-               (let-syntax ((ucode-type
-                             (sc-macro-transformer
-                              (lambda (form environment)
-                                environment
-                                (apply microcode-type (cdr form))))))
-                 (ucode-type linkage-section))
-               (system-vector-ref block index))
-              (loop (disassembler/write-linkage-section block
-                                                        symbol-table
-                                                        index)))
-             (else
-              (disassembler/write-instruction
-               symbol-table
-               (compiled-code-block/index->offset index)
-               (lambda ()
-                 (write-constant block
-                                 symbol-table
-                                 (system-vector-ref block index))))
-              (loop (1+ index))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (system-vector-length block)))
+       (let loop ((index (compiled-code-block/constants-start block)))
+         (cond ((not (< index end)) 'DONE)
+               ((object-type?
+                 (let-syntax ((ucode-type
+                               (sc-macro-transformer
+                                (lambda (form environment)
+                                  environment
+                                  (apply microcode-type (cdr form))))))
+                   (ucode-type linkage-section))
+                 (system-vector-ref block index))
+                (loop (disassembler/write-linkage-section block
+                                                          symbol-table
+                                                          index)))
+               (else
+                (disassembler/write-instruction
+                 symbol-table
+                 (compiled-code-block/index->offset index)
+                 (lambda ()
+                   (write-constant block
+                                   symbol-table
+                                   (system-vector-ref block index))))
+                (loop (1+ index)))))))))
 
 (define (write-constant block symbol-table constant)
   (write-string (cdr (write-to-string constant 60)))
index c259fc3884d3bafd7a33186cf8e03f8d57f87dff..1d4fee559ef4635a0e2ba7b6f80e2af43bf04d0d 100644 (file)
@@ -117,22 +117,23 @@ USA.
   (disassembler/instructions #f start-address end-address #f))
 
 (define (disassembler/write-instruction-stream symbol-table instruction-stream)
-  (fluid-let ((*unparser-radix* 16))
-    (disassembler/for-each-instruction instruction-stream
-      (lambda (offset instruction comment)
-       (disassembler/write-instruction
-        symbol-table
-        offset
-        (lambda ()
-          (if comment
-              (let ((s (with-output-to-string
-                         (lambda () (display instruction)))))
-                (if (< (string-length s) 40)
-                    (write-string (string-pad-right s 40))
-                    (write-string s))
-                (write-string "; ")
-                (display comment))
-              (write instruction))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (disassembler/for-each-instruction instruction-stream
+       (lambda (offset instruction comment)
+         (disassembler/write-instruction
+          symbol-table
+          offset
+          (lambda ()
+            (if comment
+                (let ((s (with-output-to-string
+                           (lambda () (display instruction)))))
+                  (if (< (string-length s) 40)
+                      (write-string (string-pad-right s 40))
+                      (write-string s))
+                  (write-string "; ")
+                  (display comment))
+                (write instruction)))))))))
 
 (define (disassembler/for-each-instruction instruction-stream procedure)
   (let loop ((instruction-stream instruction-stream))
@@ -143,30 +144,31 @@ USA.
            (loop (instruction-stream)))))))
 \f
 (define (disassembler/write-constants-block block symbol-table)
-  (fluid-let ((*unparser-radix* 16))
-    (let ((end (system-vector-length block)))
-      (let loop ((index (compiled-code-block/marked-start block)))
-       (cond ((not (< index end)) 'DONE)
-             ((object-type?
-               (let-syntax ((ucode-type
-                             (sc-macro-transformer
-                              (lambda (form environment)
-                                environment
-                                (apply microcode-type (cdr form))))))
-                 (ucode-type linkage-section))
-               (system-vector-ref block index))
-              (loop (disassembler/write-linkage-section block
-                                                        symbol-table
-                                                        index)))
-             (else
-              (disassembler/write-instruction
-               symbol-table
-               (compiled-code-block/index->offset index)
-               (lambda ()
-                 (write-constant block
-                                 symbol-table
-                                 (system-vector-ref block index))))
-              (loop (1+ index))))))))
+  (let-fluid *unparser-radix* 16
+    (lambda ()
+      (let ((end (system-vector-length block)))
+       (let loop ((index (compiled-code-block/marked-start block)))
+         (cond ((not (< index end)) 'DONE)
+               ((object-type?
+                 (let-syntax ((ucode-type
+                               (sc-macro-transformer
+                                (lambda (form environment)
+                                  environment
+                                  (apply microcode-type (cdr form))))))
+                   (ucode-type linkage-section))
+                 (system-vector-ref block index))
+                (loop (disassembler/write-linkage-section block
+                                                          symbol-table
+                                                          index)))
+               (else
+                (disassembler/write-instruction
+                 symbol-table
+                 (compiled-code-block/index->offset index)
+                 (lambda ()
+                   (write-constant block
+                                   symbol-table
+                                   (system-vector-ref block index))))
+                (loop (1+ index)))))))))
 
 (define (write-constant block symbol-table constant)
   (write-string (cdr (write-to-string constant 60)))
index ff1a33b8d10751f25417e9bb89ff86278564fc58..d2ccb48f9af52da46673a58fd1c9cae6df9d04d8 100644 (file)
@@ -1013,19 +1013,20 @@ Prefix argument means do not kill the debugger buffer."
        port))))
 
 (define (print-with-subexpression expression subexpression)
-  (fluid-let ((*unparse-primitives-by-name?* #t))
-    (if (invalid-subexpression? subexpression)
-       (write (unsyntax expression))
-       (let ((sub (write-to-string (unsyntax subexpression))))
-         (write (unsyntax-with-substitutions
-                 expression
-                 (list
-                  (cons subexpression
-                        (unparser-literal/make
-                         (string-append
-                          (ref-variable subexpression-start-marker)
-                          sub
-                          (ref-variable subexpression-end-marker)))))))))))
+  (let-fluid *unparse-primitives-by-name?* #t
+    (lambda ()
+      (if (invalid-subexpression? subexpression)
+         (write (unsyntax expression))
+         (let ((sub (write-to-string (unsyntax subexpression))))
+           (write (unsyntax-with-substitutions
+                   expression
+                   (list
+                    (cons subexpression
+                          (unparser-literal/make
+                           (string-append
+                            (ref-variable subexpression-start-marker)
+                            sub
+                            (ref-variable subexpression-end-marker))))))))))))
 \f
 (define (invalid-subexpression? subexpression)
   (or (debugging-info/undefined-expression? subexpression)
@@ -1042,10 +1043,11 @@ Prefix argument means do not kill the debugger buffer."
    port))
 
 (define (print-reduction-as-subexpression expression)
-  (fluid-let ((*unparse-primitives-by-name?* #t))
-    (write-string (ref-variable subexpression-start-marker))
-    (write (unsyntax expression))
-    (write-string (ref-variable subexpression-end-marker))))
+  (let-fluid *unparse-primitives-by-name?* #t
+    (lambda ()
+      (write-string (ref-variable subexpression-start-marker))
+      (write (unsyntax expression))
+      (write-string (ref-variable subexpression-end-marker)))))
 
 (define (print-history-level compiled? subproblem-number reduction-id
                             expression-thunk environment port)
index b5ef496d750dea63af9c462e33f3c2bd167e8895..1dc72cd9a7b6424c341bff148f8a493348de4850 100644 (file)
@@ -1281,11 +1281,12 @@ it has been renamed, it will not be deleted automatically.")
            (cond ((debugging-info/compiled-code? expression)
                   (write-string ";unknown compiled code" port))
                  ((not (debugging-info/undefined-expression? expression))
-                  (fluid-let ((*unparse-primitives-by-name?* #t))
-                    (write
-                     (unsyntax (if (invalid-subexpression? subexpression)
-                                   expression
-                                   subexpression)))))
+                  (let-fluid *unparse-primitives-by-name?* #t
+                    (lambda ()
+                      (write
+                       (unsyntax (if (invalid-subexpression? subexpression)
+                                     expression
+                                     subexpression))))))
                  ((debugging-info/noise? expression)
                   (write-string ";" port)
                   (write-string ((debugging-info/noise expression) #f)
@@ -1371,8 +1372,9 @@ it has been renamed, it will not be deleted automatically.")
            (subproblem/number (reduction/subproblem reduction)))
           port)))
     (write-string " " port)
-    (fluid-let ((*unparse-primitives-by-name?* #t))
-      (write (unsyntax (reduction/expression reduction)) port))))
+    (let-fluid *unparse-primitives-by-name?* #t
+      (lambda ()
+       (write (unsyntax (reduction/expression reduction)) port)))))
 
 (define (reduction/write-description bline port)
   (let ((reduction (bline/object bline)))
index eae8320fe18ee1b18f3c9c2a0e60859fbfb1b0e2..9ea436e89fd5f14dae318a2063fbc0191ddd3eea 100644 (file)
@@ -233,8 +233,9 @@ The values are printed in the typein window."
                 (call-with-transcript-buffer
                  (lambda (buffer)
                    (insert-string
-                    (fluid-let ((*unparse-with-maximum-readability?* #t))
-                      (write-to-string expression))
+                    (let-fluid *unparse-with-maximum-readability?* #t
+                      (lambda ()
+                        (write-to-string expression)))
                     (buffer-end buffer)))))
             (editor-eval buffer
                          expression
@@ -526,11 +527,12 @@ Set by Scheme evaluation code to update the mode line."
 (define (transcript-value-string value)
   (if (undefined-value? value)
       ""
-      (fluid-let ((*unparser-list-depth-limit*
-                  (ref-variable transcript-list-depth-limit))
-                 (*unparser-list-breadth-limit*
-                  (ref-variable transcript-list-breadth-limit)))
-       (write-to-string value))))
+      (let-fluids *unparser-list-depth-limit*
+                 (ref-variable transcript-list-depth-limit)
+                 *unparser-list-breadth-limit*
+                 (ref-variable transcript-list-breadth-limit)
+       (lambda ()
+         (write-to-string value)))))
 \f
 (define (call-with-transcript-buffer procedure)
   (let ((buffer (transcript-buffer)))
index 73308ae5c1d1ec499c6b19a27300ff9b4fe4ea6a..64d15114c07f3f4ac9524ab2c48acd903091278e 100644 (file)
@@ -728,8 +728,9 @@ If this is an error, the debugger examines the error condition."
     (lambda (mark)
       (if mark
          (insert-string
-          (fluid-let ((*unparse-with-maximum-readability?* #t))
-            (write-to-string expression))
+          (let-fluid *unparse-with-maximum-readability?* #t
+            (lambda ()
+              (write-to-string expression)))
           mark))))
   (let ((port (buffer-interface-port buffer #t)))
     ;;(move-mark-to! (port/mark port) (buffer-end buffer))
index 7372a63ede1990844acbd10126d77bbe22dd9b51..93c952b2232e4fa30e18429087aa3a52e4befcb0 100644 (file)
@@ -978,8 +978,9 @@ it is added to the front of the command history."
     (set-prompt-history-strings!
      'REPEAT-COMPLEX-COMMAND
      (map (lambda (command)
-           (fluid-let ((*unparse-with-maximum-readability?* #t))
-             (write-to-string command)))
+           (let-fluid *unparse-with-maximum-readability?* #t
+             (lambda ()
+               (write-to-string command))))
          (command-history-list)))
     (execute-command-history-entry
      (read-from-string
index 9a208153f9ff2ad4d002d98b3e29ec4cc442c553..d874f83ad1218d0adafc2364ac217c7c5586e954 100644 (file)
@@ -327,8 +327,9 @@ Otherwise, it is shown in the echo area."
                              ((symbol? argl)
                               (insert-string " . " point)
                               (insert-string (symbol-name argl) point)))))
-                   (fluid-let ((*unparse-uninterned-symbols-by-name?* #t))
-                     (message procedure-name ": " argl))))
+                   (let-fluid *unparse-uninterned-symbols-by-name?* #t
+                     (lambda ()
+                       (message procedure-name ": " argl)))))
              (editor-error "Expression does not evaluate to a procedure: "
                            (extract-string start end))))))))
 
index d2f42971885dac73a08ba63ff96fe6a88a052c37..ccec68b82a6fdb856df3ea96591dbc31935bbe9e 100644 (file)
@@ -63,7 +63,7 @@ USA.
   (lambda (state object)
     (let ((port (unparser-state/port state))
          (hash-string (number->string (hash object))))
-      (if *unparse-with-maximum-readability?*
+      (if (fluid *unparse-with-maximum-readability?*)
          (begin
            (write-string "#@" port)
            (write-string hash-string port))
index 7158a3409a83ae73155d3f639c33abc03116f079..ec28896d3c3b8910548e3ceed1fe0bb8dcb0dde3 100644 (file)
@@ -470,8 +470,9 @@ USA.
          (output-to-string
           50
           (lambda ()
-            (fluid-let ((*unparse-primitives-by-name?* true))
-              (write (unsyntax expression))))))
+            (let-fluid *unparse-primitives-by-name?* true
+              (lambda ()
+                (write (unsyntax expression)))))))
         ((debugging-info/noise? expression)
          (output-to-string
           50
@@ -950,10 +951,11 @@ using the read-eval-print environment instead.")
   (string-capitalize (if reason (string-append reason "; " message) message)))
 
 (define (debugger-pp expression indentation port)
-  (fluid-let ((*unparser-list-depth-limit* debugger:list-depth-limit)
-             (*unparser-list-breadth-limit* debugger:list-breadth-limit)
-             (*unparser-string-length-limit* debugger:string-length-limit))
-    (pretty-print expression port true indentation)))
+  (let-fluids *unparser-list-depth-limit* debugger:list-depth-limit
+             *unparser-list-breadth-limit* debugger:list-breadth-limit
+             *unparser-string-length-limit* debugger:string-length-limit
+    (lambda ()
+      (pretty-print expression port true indentation))))
 
 (define expression-indentation 4)
 \f
index 50a32f14e94579afc22f818495ec6d445d505fd8..e97fadc005857798457b34313cc8c93e9b268739 100644 (file)
@@ -602,16 +602,16 @@ USA.
   (let ((hook (fluid standard-error-hook)))
     (if hook
        (let-fluid standard-error-hook #f
-                  (lambda ()
-                    (hook condition)))))
+         (lambda ()
+           (hook condition)))))
   (repl/start (push-repl 'INHERIT condition '() "error>")))
 
 (define (standard-warning-handler condition)
   (let ((hook (fluid standard-warning-hook)))
     (if hook
        (let-fluid standard-warning-hook #f
-                  (lambda ()
-                    (hook condition)))
+         (lambda ()
+           (hook condition)))
        (let ((port (notification-output-port)))
          (fresh-line port)
          (write-string ";Warning: " port)
@@ -1243,19 +1243,20 @@ USA.
              (else (error "Unexpected value:" v)))))))
 
 (define (format-error-message message irritants port)
-  (fluid-let ((*unparser-list-depth-limit* 2)
-             (*unparser-list-breadth-limit* 5))
-    (for-each (lambda (irritant)
-               (if (and (pair? irritant)
-                        (eq? (car irritant) error-irritant/noise-tag))
-                   (display (cdr irritant) port)
-                   (begin
-                     (write-char #\space port)
-                     (write irritant port))))
-             (cons (if (string? message)
-                       (error-irritant/noise message)
-                       message)
-                   irritants))))
+  (let-fluids *unparser-list-depth-limit* 2
+             *unparser-list-breadth-limit* 5
+    (lambda ()
+      (for-each (lambda (irritant)
+                 (if (and (pair? irritant)
+                          (eq? (car irritant) error-irritant/noise-tag))
+                     (display (cdr irritant) port)
+                     (begin
+                       (write-char #\space port)
+                       (write irritant port))))
+               (cons (if (string? message)
+                         (error-irritant/noise message)
+                         message)
+                     irritants)))))
 
 (define-integrable (error-irritant/noise noise)
   (cons error-irritant/noise-tag noise))
index 5bf0de9596b30c7af422795243be0f4a15033b55..a7ec2401046be933a5957d01952daad34864048a 100644 (file)
@@ -216,23 +216,24 @@ USA.
 
 (define (pp-top-level expression port as-code? indentation list-depth)
   (fluid-let ((x-size (- (or *pp-forced-x-size* (output-port/x-size port)) 1))
-             (output-port port)
-             (*unparse-uninterned-symbols-by-name?*
-              *pp-uninterned-symbols-by-name*)
-             (*unparse-abbreviate-quotations?*
-              (or as-code?
-                  *unparse-abbreviate-quotations?*)))
-    (let* ((numerical-walk
-           (if *pp-avoid-circularity?*
-               numerical-walk-avoid-circularities
-               numerical-walk))
-          (node (numerical-walk expression list-depth)))
-      (if (positive? indentation)
-         (*unparse-string (make-string indentation #\space)))
-      (if as-code?
-         (print-node node indentation list-depth)
-         (print-non-code-node node indentation list-depth))
-      (output-port/discretionary-flush port))))
+             (output-port port))
+    (let-fluids *unparse-uninterned-symbols-by-name?*
+               *pp-uninterned-symbols-by-name*
+               *unparse-abbreviate-quotations?*
+               (or as-code?
+                   (fluid *unparse-abbreviate-quotations?*))
+      (lambda ()
+       (let* ((numerical-walk
+               (if *pp-avoid-circularity?*
+                   numerical-walk-avoid-circularities
+                   numerical-walk))
+              (node (numerical-walk expression list-depth)))
+         (if (positive? indentation)
+             (*unparse-string (make-string indentation #\space)))
+         (if as-code?
+             (print-node node indentation list-depth)
+             (print-non-code-node node indentation list-depth))
+         (output-port/discretionary-flush port))))))
 
 (define x-size)
 (define output-port)
@@ -697,15 +698,17 @@ USA.
               object))))
 \f
 (define (walk-pair pair list-depth)
-  (if (and *unparser-list-depth-limit*
-          (>= list-depth *unparser-list-depth-limit*)
-          (no-highlights? pair))
+  (if (let ((limit (fluid *unparser-list-depth-limit*)))
+       (and limit
+            (>= list-depth limit)
+            (no-highlights? pair)))
       "..."
       (let ((list-depth (+ list-depth 1)))
        (let loop ((pair pair) (list-breadth 0))
-         (cond ((and *unparser-list-breadth-limit*
-                     (>= list-breadth *unparser-list-breadth-limit*)
-                     (no-highlights? pair))
+         (cond ((let ((limit (fluid *unparser-list-breadth-limit*)))
+                  (and limit
+                       (>= list-breadth limit)
+                       (no-highlights? pair)))
                 (make-singleton-list-node "..."))
                ((null? (cdr pair))
                 (make-singleton-list-node
@@ -720,10 +723,11 @@ USA.
                        (make-list-node
                         "."
                         (make-singleton-list-node
-                         (if (and *unparser-list-breadth-limit*
-                                  (>= list-breadth
-                                      *unparser-list-breadth-limit*)
-                                  (no-highlights? pair))
+                         (if (let ((limit
+                                    (fluid *unparser-list-breadth-limit*)))
+                               (and limit
+                                    (>= list-breadth limit)
+                                    (no-highlights? pair)))
                              "..."
                              (numerical-walk (cdr pair)
                                              list-depth)))))))))))))
@@ -745,19 +749,20 @@ USA.
 
 (define (walk-highlighted-object object list-depth numerical-walk)
   (let ((dl (pph/depth-limit object)))
-    (fluid-let ((*unparser-list-breadth-limit*
-                (let ((bl (pph/breadth-limit object)))
-                  (if (eq? bl 'DEFAULT)
-                      *unparser-list-breadth-limit*
-                      bl)))
-               (*unparser-list-depth-limit*
-                (if (eq? dl 'DEFAULT)
-                    *unparser-list-depth-limit*
-                    dl)))
-      (numerical-walk (pph/object object)
-                     (if (eq? dl 'DEFAULT)
-                         list-depth
-                         0)))))
+    (let-fluids *unparser-list-breadth-limit*
+               (let ((bl (pph/breadth-limit object)))
+                 (if (eq? bl 'DEFAULT)
+                     (fluid *unparser-list-breadth-limit*)
+                     bl))
+               *unparser-list-depth-limit*
+               (if (eq? dl 'DEFAULT)
+                   (fluid *unparser-list-depth-limit*)
+                   dl)
+      (lambda ()
+       (numerical-walk (pph/object object)
+                       (if (eq? dl 'DEFAULT)
+                           list-depth
+                           0))))))
 
 \f
 ;;;     The following are circular list/vector handing procedures.  They allow
@@ -835,16 +840,18 @@ USA.
 ;;; The following two procedures walk lists and vectors, respectively.
 
 (define (walk-pair-terminating pair half-pointer/queue list-depth)
-       (if (and *unparser-list-depth-limit*
-          (>= list-depth *unparser-list-depth-limit*)
-          (no-highlights? pair))
+  (if (let ((limit (fluid *unparser-list-depth-limit*)))
+       (and limit
+            (>= list-depth limit)
+            (no-highlights? pair)))
       "..."
       (let ((list-depth (+ list-depth 1)))
        (let loop ((pair pair) (list-breadth 0)
                               (half-pointer/queue half-pointer/queue))
-         (cond ((and *unparser-list-breadth-limit*
-                     (>= list-breadth *unparser-list-breadth-limit*)
-                     (no-highlights? pair))
+         (cond ((let ((limit (fluid *unparser-list-breadth-limit*)))
+                  (and limit
+                       (>= list-breadth limit)
+                       (no-highlights? pair)))
                 (make-singleton-list-node "..."))
                ((null? (cdr pair))
                 (make-singleton-list-node
@@ -884,10 +891,10 @@ USA.
                      "."
                      (make-singleton-list-node
                       (if
-                       (and *unparser-list-breadth-limit*
-                            (>= list-breadth
-                                *unparser-list-breadth-limit*)
-                            (no-highlights? pair))
+                       (let ((limit (fluid *unparser-list-breadth-limit*)))
+                         (and limit
+                              (>= list-breadth limit)
+                              (no-highlights? pair)))
                        "..."
                        (let ((half-pointer/queue
                               (advance
@@ -901,15 +908,17 @@ USA.
                               half-pointer/queue list-depth)))))))))))))))
 \f
 (define (walk-vector-terminating pair half-pointer/queue list-depth)
-  (if (and *unparser-list-depth-limit*
-          (>= list-depth *unparser-list-depth-limit*)
-          (no-highlights? pair))
+  (if (let ((limit (fluid *unparser-list-depth-limit*)))
+       (and limit
+            (>= list-depth limit)
+            (no-highlights? pair)))
       "..."
       (let ((list-depth (+ list-depth 1)))
        (let loop ((pair pair) (list-breadth 0))
-         (cond ((and *unparser-list-breadth-limit*
-                     (>= list-breadth *unparser-list-breadth-limit*)
-                     (no-highlights? pair))
+         (cond ((let ((limit (fluid *unparser-list-breadth-limit*)))
+                  (and limit
+                       (>= list-breadth limit)
+                       (no-highlights? pair)))
                 (make-singleton-list-node "..."))
                ((null? (cdr pair))
                 (make-singleton-list-node
@@ -938,10 +947,11 @@ USA.
                        (make-list-node
                         "."
                         (make-singleton-list-node
-                         (if (and *unparser-list-breadth-limit*
-                                  (>= list-breadth
-                                      *unparser-list-breadth-limit*)
-                                  (no-highlights? pair))
+                         (if (let ((limit
+                                    (fluid *unparser-list-breadth-limit*)))
+                               (and limit
+                                    (>= list-breadth limit)
+                                    (no-highlights? pair)))
                              "..."
                              (numerical-walk-terminating
                               (cdr pair)
index fc55b18cbbbfc8dd639e6b769464146447673d36..5c69c269085f23d7b8509329b1d72b3b84b70cba 100644 (file)
@@ -542,10 +542,11 @@ USA.
      (or message
         (and condition
              (cmdl-message/strings
-              (fluid-let ((*unparser-list-depth-limit* 25)
-                          (*unparser-list-breadth-limit* 100)
-                          (*unparser-string-length-limit* 500))
-                (condition/report-string condition)))))
+              (let-fluids *unparser-list-depth-limit* 25
+                          *unparser-list-breadth-limit* 100
+                          *unparser-string-length-limit* 500
+                (lambda ()
+                  (condition/report-string condition))))))
      (and condition
          repl:allow-restart-notifications?
          (condition-restarts-message condition))
@@ -947,8 +948,8 @@ USA.
   (let ((hook (fluid standard-breakpoint-hook)))
     (if hook
        (let-fluid standard-breakpoint-hook #f
-                  (lambda ()
-                    (hook condition)))))
+         (lambda ()
+           (hook condition)))))
   (repl/start (push-repl (breakpoint/environment condition)
                         condition
                         '()
index bd9370d548b7dfb78f2039989fe0d8bc9391268a..d2d86f17174770ef578a785dbb38b1406de2d005 100644 (file)
 
 (define (profile-pp expression output-port)
   ;; Random parametrization.
-  (fluid-let ((*unparser-list-breadth-limit* 5)
-              (*unparser-list-depth-limit* 3)
-              (*unparser-string-length-limit* 40)
-              (*unparse-primitives-by-name?* #t)
-              (*pp-save-vertical-space?* #t)
-              (*pp-default-as-code?* #t))
-    (pp expression output-port)))
\ No newline at end of file
+  (let-fluids *unparser-list-breadth-limit* 5
+              *unparser-list-depth-limit* 3
+              *unparser-string-length-limit* 40
+              *unparse-primitives-by-name?* #t
+    (lambda ()
+      (fluid-let ((*pp-save-vertical-space?* #t)
+                 (*pp-default-as-code?* #t))
+       (pp expression output-port)))))
\ No newline at end of file
index f3f57aaf141b0fb7fbfabe5692d2729b7c28eaa4..df3db3f0cf6092915ef7290924a0ac0b2330de54 100644 (file)
@@ -749,14 +749,15 @@ swank:xref
     (cond ((debugging-info/compiled-code? expression)
           (write-string ";unknown compiled code" port))
          ((not (debugging-info/undefined-expression? expression))
-          (fluid-let ((*unparse-primitives-by-name?* #t))
-            (write
-             (unsyntax
-              (if (or (debugging-info/undefined-expression? subexpression)
-                      (debugging-info/unknown-expression? subexpression))
-                  expression
-                  subexpression))
-             port)))
+          (let-fluid *unparse-primitives-by-name?* #t
+            (lambda ()
+              (write
+               (unsyntax
+                (if (or (debugging-info/undefined-expression? subexpression)
+                        (debugging-info/unknown-expression? subexpression))
+                    expression
+                    subexpression))
+               port))))
          ((debugging-info/noise? expression)
           (write-string ";" port)
           (write-string ((debugging-info/noise expression) #f)
@@ -1100,10 +1101,11 @@ swank:xref
 (define (pprint-to-string o)
   (call-with-output-string
     (lambda (p)
-      (fluid-let ((*unparser-list-breadth-limit* 10)
-                 (*unparser-list-depth-limit* 4)
-                 (*unparser-string-length-limit* 100))
-       (pp o p)))))
+      (let-fluids *unparser-list-breadth-limit* 10
+                 *unparser-list-depth-limit* 4
+                 *unparser-string-length-limit* 100
+       (lambda ()
+         (pp o p))))))
 
 ;; quote keywords, t and nil
 (define (quote-special x)
index 8310b64ab812453a30ffaf625452c5b555c277b8..de922547bfb30de3e2b4e7a8355dae8d2a94a11f 100644 (file)
@@ -34,18 +34,18 @@ USA.
        (char-set-union char-set:not-graphic (char-set #\" #\\)))
   (set! hook/interned-symbol unparse-symbol)
   (set! hook/procedure-unparser #f)
-  (set! *unparser-radix* 10)
-  (set! *unparser-list-breadth-limit* #f)
-  (set! *unparser-list-depth-limit* #f)
-  (set! *unparser-string-length-limit* #f)
-  (set! *unparse-primitives-by-name?* #f)
-  (set! *unparse-uninterned-symbols-by-name?* #f)
-  (set! *unparse-with-maximum-readability?* #f)
-  (set! *unparse-compound-procedure-names?* #t)
-  (set! *unparse-with-datum?* #f)
-  (set! *unparse-abbreviate-quotations?* #f)
+  (set! *unparser-radix* (make-fluid 10))
+  (set! *unparser-list-breadth-limit* (make-fluid #f))
+  (set! *unparser-list-depth-limit* (make-fluid #f))
+  (set! *unparser-string-length-limit* (make-fluid #f))
+  (set! *unparse-primitives-by-name?* (make-fluid #f))
+  (set! *unparse-uninterned-symbols-by-name?* (make-fluid #f))
+  (set! *unparse-with-maximum-readability?* (make-fluid #f))
+  (set! *unparse-compound-procedure-names?* (make-fluid #t))
+  (set! *unparse-with-datum?* (make-fluid #f))
+  (set! *unparse-abbreviate-quotations?* (make-fluid #f))
   (set! system-global-unparser-table (make-system-global-unparser-table))
-  (set! *unparser-table* system-global-unparser-table)
+  (set! *unparser-table* (make-fluid system-global-unparser-table))
   (set! *default-unparser-state* #f)
   (set! non-canon-symbol-quoted
        (char-set-union char-set/atom-delimiters
@@ -182,8 +182,7 @@ USA.
              (*environment* environment)
              (*dispatch-table*
               (unparser-table/dispatch-vector
-               (let ((table
-                      (repl-environment-value environment '*UNPARSER-TABLE*)))
+               (let ((table (fluid *unparser-table*)))
                  (guarantee-unparser-table table #f)
                  table))))
     (*unparse-object object)))
@@ -233,7 +232,7 @@ USA.
   (*unparse-hash object))
 
 (define (*unparse-with-brackets name object thunk)
-  (if (and *unparse-with-maximum-readability?* object)
+  (if (and (fluid *unparse-with-maximum-readability?*) object)
       (*unparse-readable-hash object)
       (begin
        (*unparse-string "#[")
@@ -248,7 +247,7 @@ USA.
            (begin
              (*unparse-char #\space)
              (thunk))
-           (if *unparse-with-datum?*
+           (if (fluid *unparse-with-datum?*)
                (begin
                  (*unparse-char #\space)
                  (*unparse-datum object))))
@@ -325,7 +324,7 @@ USA.
 (define hook/interned-symbol)
 
 (define (unparse/uninterned-symbol symbol)
-  (if *unparse-uninterned-symbols-by-name?*
+  (if (fluid *unparse-uninterned-symbols-by-name?*)
       (unparse-symbol symbol)
       (*unparse-with-brackets 'UNINTERNED-SYMBOL symbol
        (lambda ()
@@ -405,9 +404,10 @@ USA.
   (if *slashify?*
       (let ((end (string-length string)))
        (let ((end*
-              (if *unparser-string-length-limit*
-                  (min *unparser-string-length-limit* end)
-                  end)))
+              (let ((limit (fluid *unparser-string-length-limit*)))
+                (if limit
+                    (min limit end)
+                    end))))
          (*unparse-char #\")
          (if (substring-find-next-char-in-set string 0 end*
                                               string-delimiters)
@@ -493,8 +493,8 @@ USA.
             (let loop ((index 1))
               (cond ((fix:= index length)
                      (*unparse-char #\)))
-                    ((and *unparser-list-breadth-limit*
-                          (>= index *unparser-list-breadth-limit*))
+                    ((let ((limit (fluid *unparser-list-breadth-limit*)))
+                       (and limit (>= index limit)))
                      (*unparse-string " ...)"))
                     (else
                      (*unparse-char #\space)
@@ -511,7 +511,7 @@ USA.
   (map-reference-trap (lambda () (vector-ref vector index))))
 
 (define (unparse/record record)
-  (if *unparse-with-maximum-readability?*
+  (if (fluid *unparse-with-maximum-readability?*)
       (*unparse-readable-hash record)
       (invoke-user-method unparse-record record)))
 \f
@@ -532,12 +532,13 @@ USA.
      (*unparse-char #\)))))
 
 (define (limit-unparse-depth kernel)
-  (if *unparser-list-depth-limit*
-      (fluid-let ((*list-depth* (+ *list-depth* 1)))
-       (if (> *list-depth* *unparser-list-depth-limit*)
-           (*unparse-string "...")
-           (kernel)))
-      (kernel)))
+  (let ((limit (fluid *unparser-list-depth-limit*)))
+    (if limit
+       (fluid-let ((*list-depth* (+ *list-depth* 1)))
+         (if (> *list-depth* limit)
+             (*unparse-string "...")
+             (kernel)))
+       (kernel))))
 
 (define (unparse-tail l n)
   (cond ((pair? l)
@@ -549,9 +550,10 @@ USA.
               (begin
                 (*unparse-char #\space)
                 (*unparse-object (safe-car l))
-                (if (and *unparser-list-breadth-limit*
-                         (>= n *unparser-list-breadth-limit*)
-                         (pair? (safe-cdr l)))
+                (if (let ((limit (fluid *unparser-list-breadth-limit*)))
+                      (and limit
+                           (>= n limit)
+                           (pair? (safe-cdr l))))
                     (*unparse-string " ...")
                     (unparse-tail (safe-cdr l) (+ n 1)))))))
        ((not (null? l))
@@ -572,7 +574,7 @@ USA.
   (*unparse-object (safe-car (safe-cdr pair))))
 
 (define (unparse-list/prefix-pair? object)
-  (and *unparse-abbreviate-quotations?*
+  (and (fluid *unparse-abbreviate-quotations?*)
        (pair? (safe-cdr object))
        (null? (safe-cdr (safe-cdr object)))
        (case (safe-car object)
@@ -608,7 +610,7 @@ USA.
   (unparse-procedure procedure
     (lambda ()
       (*unparse-with-brackets 'COMPOUND-PROCEDURE procedure
-       (and *unparse-compound-procedure-names?*
+       (and (fluid *unparse-compound-procedure-names?*)
             (lambda-components* (procedure-lambda procedure)
               (lambda (name required optional rest body)
                 required optional rest body
@@ -621,9 +623,9 @@ USA.
       (let ((unparse-name
             (lambda ()
               (*unparse-object (primitive-procedure-name procedure)))))
-       (cond (*unparse-primitives-by-name?*
+       (cond ((fluid *unparse-primitives-by-name?*)
               (unparse-name))
-             (*unparse-with-maximum-readability?*
+             ((fluid *unparse-with-maximum-readability?*)
               (*unparse-readable-hash procedure))
              (else
               (*unparse-with-brackets 'PRIMITIVE-PROCEDURE #f
@@ -705,7 +707,7 @@ USA.
                       (*unparse-string prefix))
                   radix)
                 10))))
-      (case *unparser-radix*
+      (case (fluid *unparser-radix*)
        ((2) (prefix "#b" 2 2))
        ((8) (prefix "#o" 8 8))
        ((16) (prefix "#x" 10 16))
@@ -721,9 +723,10 @@ USA.
     (*unparse-with-brackets "floating-vector" v
       (and (not (zero? length))
           (lambda ()
-            (let ((limit (if (not *unparser-list-breadth-limit*)
-                             length
-                             (min length *unparser-list-breadth-limit*))))
+            (let ((limit (let ((limit (fluid *unparser-list-breadth-limit*)))
+                           (if (not limit)
+                               length
+                               (min length limit)))))
               (unparse/flonum ((ucode-primitive floating-vector-ref) v 0))
               (do ((i 1 (+ i 1)))
                   ((>= i limit))
@@ -753,7 +756,7 @@ USA.
                       (compiled-procedure/name proc))
                  => named-arity-dispatched-procedure)
                 (else (plain 'ARITY-DISPATCHED-PROCEDURE)))))
-       (*unparse-with-maximum-readability?*
+       ((fluid *unparse-with-maximum-readability?*)
         (*unparse-readable-hash entity))
        ((record? (entity-extra entity))
         ;; Kludge to make the generic dispatch mechanism work.
index 1f9debff455d553f0ee8fc0ffc89de900cc3b69f..3483726aba151019a26c2b6d84bd7380850c97c1 100644 (file)
@@ -244,6 +244,7 @@ USA.
 ;;; Debugging utility
 (define (pp-expression form #!optional port)
   (fluid-let ((*pp-primitives-by-name* #f)
-             (*pp-uninterned-symbols-by-name* #f)
-             (*unparse-abbreviate-quotations?* #t))
-    (pp (cgen/external-with-declarations form) port)))
\ No newline at end of file
+             (*pp-uninterned-symbols-by-name* #f))
+    (let-fluid *unparse-abbreviate-quotations?* #t
+      (lambda ()
+       (pp (cgen/external-with-declarations form) port)))))
index 8f32c51a44e142bc4a4b105c7ab574fabd252cc4..4e423d5c807063d00c10c4aacd725582ffbaede1 100644 (file)
@@ -154,14 +154,14 @@ USA.
   (let ((newval (if (default-object? newval) false newval)))
     (if (not (or (not newval) (and (exact-integer? newval) (> newval 0))))
        (error:illegal-datum newval 'PRINT-DEPTH))
-    (set! *unparser-list-depth-limit* newval)
+    (set-fluid! *unparser-list-depth-limit* newval)
     unspecific))
 
 (define (print-breadth #!optional newval)
   (let ((newval (if (default-object? newval) false newval)))
     (if (not (or (not newval) (and (exact-integer? newval) (> newval 0))))
        (error:illegal-datum newval 'PRINT-BREADTH))
-    (set! *unparser-list-breadth-limit* newval)
+    (set-fluid! *unparser-list-breadth-limit* newval)
     unspecific))
 
 (define (ceiling->exact number)
index 076b6fe882fae13f8fb5423386c934f25a958bfe..2c5dd5cc5e51303444a5ada5f15cd25eb567102e 100644 (file)
@@ -2,8 +2,8 @@
 
 ;; to make this possible to debug
 
-; (set! *unparser-list-breadth-limit* 10)
-; (set! *unparser-list-depth-limit* 10)
+; (set-fluid! *unparser-list-breadth-limit* 10)
+; (set-fluid! *unparser-list-depth-limit* 10)
 
 
 ;; GC stress test
index ab2fd345011ee68469bab0d09ccc54467fc9c085..ed94c44c63ed789010363a740ff4f9db0098fdd1 100644 (file)
@@ -229,8 +229,9 @@ USA.
 
 (define (write-expr-property tag p port)
   (write-tag tag port)
-  (fluid-let ((*unparse-abbreviate-quotations?* #t))
-    (write (cdr p) port)))
+  (let-fluid *unparse-abbreviate-quotations?* #t
+    (lambda ()
+      (write (cdr p) port))))
 
 (define (write-tag tag port)
   (if tag