Changeset 35796 in project


Ignore:
Timestamp:
07/08/18 02:39:21 (13 days ago)
Author:
kon
Message:

fix ret typs, faster unistr

Location:
release/5/string-utils/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/string-utils/trunk/string-utils.egg

    r35791 r35796  
    33
    44((synopsis "String Utilities")
    5  (version "2.0.0")
     5 (version "2.0.1")
    66 (category data)
    77 (author "[[kon lovett]]")
  • release/5/string-utils/trunk/unicode-utils.scm

    r35791 r35796  
    4545      (and (fx< 0 x) (fx< x #x80)) ) ) )
    4646
    47 (: unicode-char->string (char --> string))
     47(: unicode-char->string (char -> string))
    4848;
    4949(define (unicode-char->string ch)
     
    5151
    5252;inefficient
    53 (: unicode-string (#!rest (list-of char) --> string))
     53(: unicode-string (#!rest (list-of char) -> string))
    5454;
    5555(define (unicode-string . chs)
     
    6262      (*unicode-string chs) ) ) )
    6363
    64 (: unicode-make-string (fixnum #!optional char --> string))
     64(: unicode-make-string (fixnum #!optional char -> string))
    6565;
    6666(define (unicode-make-string len #!optional (fill #\space))
     
    7878    (##sys#unicode-surrogate? n) ) )
    7979
    80 (: unicode-surrogates->codepoint (fixnum fixnum --> (or boolean fixnum)))
     80(: unicode-surrogates->codepoint (fixnum fixnum -> (or boolean fixnum)))
    8181;
    8282(define (unicode-surrogates->codepoint hi lo)
     
    8585    (check-natural-fixnum 'unicode-surrogates->codepoint lo "low")) )
    8686
    87 (: *unicode-make-string (fixnum char --> string))
     87(: *unicode-make-string (fixnum char -> string))
    8888;
    8989(define (*unicode-make-string len fill)
     
    9696      (*unicode-string (the (list-of char) (make-list len fill))) ) ) )
    9797
    98 ;inefficient
    99 (: *unicode-string ((list-of char) --> string))
     98(: *unicode-string ((list-of char) -> string))
    10099;
    101100(define (*unicode-string chs)
     
    106105      (##sys#char->utf8-string (car chs)) )
    107106    (else
    108       (string-concatenate (map ##sys#char->utf8-string chs)) ) ) )
     107      (let ((chs (map ##sys#char->utf8-string chs)))
     108        (##sys#fragments->string
     109          (foldl (lambda (l s) (fx+ l (##sys#size s))) 0 chs)
     110          chs) ) ) ) )
    109111
    110112) ;module unicode-utils
Note: See TracChangeset for help on using the changeset viewer.