Changeset 35787 in project
- Timestamp:
- 07/07/18 03:07:37 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
release/4/string-utils/trunk/unicode-utils.scm
r35184 r35787 5 5 ;; 6 6 ;; - Implies Unicode support that is not present. 7 8 (declare 9 (bound-to-procedure 10 ##sys#string-append 11 ##sys#char->utf8-string 12 ##sys#unicode-surrogate? 13 ##sys#surrogates->codepoint)) 7 14 8 15 (module unicode-utils … … 23 30 (only type-checks check-natural-fixnum check-char)) 24 31 25 (declare26 (bound-to-procedure27 ##sys#string-append28 ##sys#char->utf8-string29 ##sys#unicode-surrogate?30 ##sys#surrogates->codepoint))31 32 32 ;; Simple UTF 8 33 33 34 ;nul is not accepted! 34 35 (: ascii-codepoint? (* -> boolean : char)) 35 36 ; … … 38 39 (char? ch) 39 40 (let ((x (char->integer ch))) 40 (and (fx<= 0 x) (fx<= x #x7f)) ) ) ) 41 ;[1 7f] = (1 80) 42 (and (fx< 0 x) (fx< x #x80)) ) ) ) 41 43 42 44 (: unicode-char->string (char --> string)) … … 57 59 (*unicode-string chs) ) ) ) 58 60 59 (: generic-make-string (fixnum char --> string))60 ;61 (define (generic-make-string len ch)62 (if (ascii-codepoint? ch)63 (make-string len ch)64 (unicode-make-string len ch) ) )65 66 61 (: unicode-make-string (fixnum #!optional char --> string)) 67 62 ; … … 70 65 (check-natural-fixnum 'unicode-make-string len) 71 66 (check-char 'unicode-make-string fill)) ) 67 68 (define generic-make-string unicode-make-string) 72 69 73 70 (: unicode-surrogate? (* -> boolean : fixnum))
Note: See TracChangeset
for help on using the changeset viewer.