From 47d387018fea9b8399fdf1dd135bbf62ceea93bd Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 19 Feb 2017 01:29:04 -0800 Subject: [PATCH] Move char->string to ustring. --- src/runtime/runtime.pkg | 2 +- src/runtime/string.scm | 4 ---- src/runtime/ustring.scm | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 0e642d2b7..8918a406e 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1041,7 +1041,6 @@ USA. vector-8b-set!) (export () camel-case-string->lisp - char->string guarantee-substring guarantee-substring-end-index guarantee-substring-start-index @@ -1090,6 +1089,7 @@ USA. (substring-move-left! substring-move!) (substring-move-right! substring-move!) burst-string + char->string decorated-string-append string-find-next-char string-find-next-char-ci diff --git a/src/runtime/string.scm b/src/runtime/string.scm index d5f027c5c..b9a201a87 100644 --- a/src/runtime/string.scm +++ b/src/runtime/string.scm @@ -88,10 +88,6 @@ USA. (define %words->octets-shift (- %octets->words-shift)) -(define (char->string char) - (guarantee 8-bit-char? char 'CHAR->STRING) - (make-string 1 char)) - (define (reverse-string string) (guarantee-string string 'REVERSE-STRING) (%reverse-substring string 0 (string-length string))) diff --git a/src/runtime/ustring.scm b/src/runtime/ustring.scm index 1068d7563..65fc82045 100644 --- a/src/runtime/ustring.scm +++ b/src/runtime/ustring.scm @@ -558,13 +558,7 @@ USA. (define (->string object caller) (cond ((not object) "") - ((bitless-char? object) - (let ((s - (if (char-8-bit? object) - (legacy-string-allocate 1) - (full-string-allocate 1)))) - (string-set! s 0 object) - s)) + ((bitless-char? object) (char->string object)) ((string? object) object) ((symbol? object) (symbol->string object)) ((pathname? object) (->namestring object)) @@ -904,4 +898,13 @@ USA. (string-upper-case? (string-slice string start end))) (define (string-null? string) - (fix:= 0 (string-length string))) \ No newline at end of file + (fix:= 0 (string-length string))) + +(define (char->string char) + (guarantee bitless-char? char 'char->string) + (let ((s + (if (char-8-bit? char) + (legacy-string-allocate 1) + (full-string-allocate 1)))) + (string-set! s 0 char) + s)) \ No newline at end of file -- 2.25.1