diff --git a/lib/chibi/show.sld b/lib/chibi/show.sld index fb882276..ead2b577 100644 --- a/lib/chibi/show.sld +++ b/lib/chibi/show.sld @@ -1,7 +1,7 @@ (define-library (chibi show) (export - show fn fn-fork with update! each each-in-list call-with-output + show fn fn-fork with with! each each-in-list call-with-output displayed written written-shared written-simply numeric numeric/comma numeric/si numeric/fitted nothing nl fl space-to tab-to escaped maybe-escaped diff --git a/lib/chibi/show/base.scm b/lib/chibi/show/base.scm index 695d457d..f4489db6 100644 --- a/lib/chibi/show/base.scm +++ b/lib/chibi/show/base.scm @@ -14,7 +14,7 @@ (bind: %fn) (bind-fork: fn-fork) (local: %with) - (local!: update!) + (local!: with!) (return: return) (run: run) (fields: @@ -75,14 +75,14 @@ ;; Run with an output port with initial default values. (define (show-run out proc) - (run (sequence (update! (port out) - (col 0) - (row 0) - (width 78) - (radix 10) - (pad-char #\space) - (output output-default) - (string-width substring-length)) + (run (sequence (with! (port out) + (col 0) + (row 0) + (width 78) + (radix 10) + (pad-char #\space) + (output output-default) + (string-width substring-length)) proc))) ;;> Temporarily bind the parameters in the body \var{x}. @@ -94,7 +94,7 @@ ;;> The noop formatter. Generates no output and leaves the state ;;> unmodified. -(define nothing (fn () (update!))) +(define nothing (fn () (with!))) ;;> Formats a displayed version of x - if a string or char, outputs the ;;> raw characters (as with `display'), if x is already a formatter @@ -131,9 +131,9 @@ (display str port) (let ((nl-index (string-find-right str #\newline))) (if (string-cursor>? nl-index (string-cursor-start str)) - (update! (row (+ row (string-count str #\newline))) - (col (string-width str (string-cursor->index str nl-index)))) - (update! (col (+ col (string-width str)))))))) + (with! (row (+ row (string-count str #\newline))) + (col (string-width str (string-cursor->index str nl-index)))) + (with! (col (+ col (string-width str)))))))) ;;> Captures the output of \var{producer} and formats the result with ;;> \var{consumer}. diff --git a/lib/chibi/show/base.sld b/lib/chibi/show/base.sld index 6cf08564..8b2f8a46 100644 --- a/lib/chibi/show/base.sld +++ b/lib/chibi/show/base.sld @@ -1,7 +1,7 @@ (define-library (chibi show base) (export - show fn fn-fork with update! each each-in-list call-with-output + show fn fn-fork with with! each each-in-list call-with-output displayed written written-shared written-simply numeric nothing escaped maybe-escaped numeric/si numeric/fitted numeric/comma ;; internal diff --git a/lib/chibi/show/column.scm b/lib/chibi/show/column.scm index d49af877..826a21c0 100644 --- a/lib/chibi/show/column.scm +++ b/lib/chibi/show/column.scm @@ -30,10 +30,10 @@ (let ((nl-index (string-index-right str (lambda (ch) (eqv? ch #\newline))))) (if (string-cursor>? nl-index (string-cursor-start str)) - (update! + (with! (row (+ row (string-count str (lambda (ch) (eqv? ch #\newline))))) (col (string-width str (string-cursor->index str nl-index)))) - (update! (col (+ col (string-width str)))))) + (with! (col (+ col (string-width str)))))) (call-with-current-continuation (lambda (cc) (set! resume cc) diff --git a/lib/chibi/show/show.scm b/lib/chibi/show/show.scm index f373405a..602736bf 100644 --- a/lib/chibi/show/show.scm +++ b/lib/chibi/show/show.scm @@ -223,7 +223,7 @@ (let* ((end (max 0 (- len (- chars-written width)))) (s (substring str 0 end))) (each (output s) - (update! (output orig-output)) + (with! (output orig-output)) (fn () (return nothing)))) (output str)))) (with ((output output*)) diff --git a/lib/srfi/159.sld b/lib/srfi/159.sld index 6c180b9b..ca254724 100644 --- a/lib/srfi/159.sld +++ b/lib/srfi/159.sld @@ -4,7 +4,7 @@ (srfi 159 unicode) (srfi 159 color)) (export ;; base - show fn fn-fork with update! each each-in-list call-with-output + show fn fn-fork with with! each each-in-list call-with-output displayed written written-shared written-simply numeric numeric/comma numeric/si numeric/fitted nothing nl fl space-to tab-to escaped maybe-escaped diff --git a/tests/lib-tests.scm b/tests/lib-tests.scm index e05fa4b4..b0e285fc 100644 --- a/tests/lib-tests.scm +++ b/tests/lib-tests.scm @@ -49,6 +49,7 @@ (rename (chibi regexp-test) (run-tests run-regexp-tests)) (rename (chibi scribble-test) (run-tests run-scribble-tests)) (rename (chibi show-test) (run-tests run-show-tests)) + (rename (chibi show c-test) (run-tests run-show-c-tests)) (rename (chibi string-test) (run-tests run-string-tests)) (rename (chibi system-test) (run-tests run-system-tests)) (rename (chibi tar-test) (run-tests run-tar-tests)) @@ -106,6 +107,7 @@ (run-string-tests) (run-sha2-tests) (run-show-tests) +(run-show-c-tests) (run-system-tests) (run-tar-tests) (run-uri-tests)