mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
rename (chibi show) update! to with! as in srfi 159
This commit is contained in:
parent
309c591d66
commit
03544833dc
7 changed files with 21 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
(bind: %fn)
|
||||
(bind-fork: fn-fork)
|
||||
(local: %with)
|
||||
(local!: update!)
|
||||
(local!: with!)
|
||||
(return: return)
|
||||
(run: run)
|
||||
(fields:
|
||||
|
@ -75,7 +75,7 @@
|
|||
|
||||
;; Run with an output port with initial default values.
|
||||
(define (show-run out proc)
|
||||
(run (sequence (update! (port out)
|
||||
(run (sequence (with! (port out)
|
||||
(col 0)
|
||||
(row 0)
|
||||
(width 78)
|
||||
|
@ -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)))
|
||||
(with! (row (+ row (string-count str #\newline)))
|
||||
(col (string-width str (string-cursor->index str nl-index))))
|
||||
(update! (col (+ col (string-width str))))))))
|
||||
(with! (col (+ col (string-width str))))))))
|
||||
|
||||
;;> Captures the output of \var{producer} and formats the result with
|
||||
;;> \var{consumer}.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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*))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue