diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-08-14 19:25:26 +0200 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-08-14 19:25:26 +0200 |
commit | caae83f445935c06cd6aef36f283a4688675278a (patch) | |
tree | 5e63cbfd2877195430a8657dcd75f42b6a4d7110 /ebus-racket/3rdparty/bzlib/base/text.ss | |
download | ebus-caae83f445935c06cd6aef36f283a4688675278a.tar.gz ebus-caae83f445935c06cd6aef36f283a4688675278a.zip |
refactored ebus code
Diffstat (limited to 'ebus-racket/3rdparty/bzlib/base/text.ss')
-rw-r--r-- | ebus-racket/3rdparty/bzlib/base/text.ss | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ebus-racket/3rdparty/bzlib/base/text.ss b/ebus-racket/3rdparty/bzlib/base/text.ss new file mode 100644 index 0000000..1185b17 --- /dev/null +++ b/ebus-racket/3rdparty/bzlib/base/text.ss @@ -0,0 +1,69 @@ +#lang scheme/base +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; BASE.plt - common routines that are shared by all other bzlib modules +;; +;; in a way, base.plt is the most fundamental module of the whole bzlib stack +;; and as such it also is the lowest level code. We are not likely to +;; fix the code any time soon, and hence any of the functions here are +;; explicitly likely to be obsoleted or moved elsewhere. +;; +;; Proceed with caution. +;; +;; +;; Bonzai Lab, LLC. All rights reserved. +;; +;; Licensed under LGPL. +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; text.ss - basic "text" (or string) service. +;; yc 9/8/2009 - first version +;; yc 2/1/2010 - adding the ability to extend the behavior of the string function... +(require "base.ss" + scheme/string + "registry.ss" + scheme/function + scheme/contract + ) + +(define default->string (curry format "~a")) + +(define string-converter-table (make-cond-registry '())) + +(define (string-converter-ref obj) + (registry-ref string-converter-table obj default->string)) + +(define (string-converter-set! type? converter) + (registry-set! string-converter-table type? converter)) + +(define (string-converter-del! type?) + (registry-del! string-converter-table type?));; + +(define (stringify* arg . args) + (stringify (cons arg args))) + +(define (any->string v) + (cond ((string? v) v) + (else + ((string-converter-ref v) v)))) + +(define (stringify args) + (string-join (map any->string args) "")) + +(provide/contract + (stringify* (->* (any/c) + () + #:rest (listof any/c) + string?)) + (stringify (-> (listof any/c) string?)) + ;;(string-converter-table registry?) + (string-converter-ref (-> any/c any)) + (string-converter-set! (-> procedure? procedure? any)) + (string-converter-del! (-> procedure? any)) + (any->string (-> any/c string?)) + (rename stringify* any*->string (->* (any/c) + () + #:rest (listof any/c) + string?)) + (rename stringify any/list->string (-> (listof any/c) string?)) + ) + +(provide (all-from-out scheme/string))
\ No newline at end of file |