Begin process of replacing string operations with ustring equivalents.
authorChris Hanson <org/chris-hanson/cph>
Sat, 18 Feb 2017 03:58:14 +0000 (19:58 -0800)
committerChris Hanson <org/chris-hanson/cph>
Sat, 18 Feb 2017 03:58:14 +0000 (19:58 -0800)
src/runtime/arith.scm
src/runtime/chrset.scm
src/runtime/dragon4.scm
src/runtime/hashtb.scm
src/runtime/rgxcmp.scm
src/runtime/runtime.pkg
src/runtime/ustring.scm

index 5603e4933ade43e069447e471a702b39e07e90fa..4f189cec5db4d14c3085b0427fdfb1dc7d5f962d 100644 (file)
@@ -468,9 +468,9 @@ USA.
   (cond ((not (int:integer? number))
         (error:wrong-type-argument number #f 'NUMBER->STRING))
        ((int:negative? number)
-        (list->string (cons #\- (n>0 (int:negate number)))))
+        (list->ustring (cons #\- (n>0 (int:negate number)))))
        (else
-        (list->string (n>0 number)))))
+        (list->ustring (n>0 number)))))
 \f
 (declare (integrate-operator rat:rational?))
 (define (rat:rational? object)
index 9b27294bdb88d219d8e98af400d4d589d2ef1cfb..fc4293192791ea706101cd69a65910734d9af198 100644 (file)
@@ -533,7 +533,7 @@ USA.
 
 ;; Returns ASCII string:
 (define (char-set->string char-set)
-  (list->string (char-set-members char-set)))
+  (list->ustring (char-set-members char-set)))
 
 ;; Returns only ASCII members:
 (define (char-set-members char-set)
index c09572addaffcfd72666ca93ef111effc0256668..b033a894db237927ceeaec48711e901802297e62 100644 (file)
@@ -80,7 +80,7 @@ not much different to numbers within a few orders of magnitude of 1.
                     (dragon4 f e p radix cutoff-mode cutoff
                       (lambda (u k generate)
                         (let ((digits
-                               (list->string
+                               (list->ustring
                                 (let loop ((u u) (k k) (generate generate))
                                   k    ;ignore
                                   (if (negative? u)
index 0eeebc207c35e14643d2f81fda2171791d42ea45..dd3b6642a1706e03e18a79202724c151ff3680aa 100644 (file)
@@ -1299,13 +1299,10 @@ USA.
   (make-hash-table-type key-hash
                        key=?
                        (if (and (or (eq? key=? string=?)
-                                    (eq? key=? string-ci=?)
-                                    (eq? key=? ustring=?))
-                                (or (eq? key-hash string-hash-mod)
-                                    (eq? key-hash string-hash)
-                                    (eq? key-hash ustring-hash)
-                                    (eq? key-hash hash)
-                                    (eq? key-hash string-ci-hash)))
+                                    (eq? key=? string-ci=?))
+                                (or (eq? key-hash string-hash)
+                                    (eq? key-hash string-ci-hash)
+                                    (eq? key-hash hash)))
                            #f          ;No rehash needed after GC
                            #t)         ;Rehash needed after GC
                        hash-table-entry-type:strong))
index 30c69a05ebe26e45266bbd5d690cf345bcc198f1..2f3ab92c5600243256f3e23d5703cf3aec034c9c 100644 (file)
@@ -380,7 +380,7 @@ USA.
                (if (not (stack-empty? ctx))
                    (compilation-error ctx "Unmatched \\("))
                (make-compiled-regexp
-                (list->string (map integer->char (cdr (output-head ctx))))
+                (list->ustring (map integer->char (cdr (output-head ctx))))
                 case-fold?))
              (begin
                (compile-pattern-char ctx)
@@ -695,7 +695,7 @@ USA.
                                                          (char->integer char)))
                 (char-set-members
                  (re-compile-char-set
-                  (list->string (map integer->char (reverse! chars)))
+                  (list->ustring (map integer->char (reverse! chars)))
                   #f))))
              (loop (cons char chars)))))
       (output-start! ctx (if invert? re-code:not-char-set re-code:char-set))
index 50c6df73db721cbeca323ebcea73027919401d2f..2539d8aee0419e346f33e1ceeeb8a82dbcfb0f45 100644 (file)
@@ -1050,7 +1050,7 @@ USA.
          guarantee-substring-end-index
          guarantee-substring-start-index
          lisp-string->camel-case
-         list->string
+         ;;list->string
          make-string
          reverse-string
          reverse-string!
@@ -1058,19 +1058,19 @@ USA.
          reverse-substring!
          set-string-length!
          string
-         string->list
-         string->vector
+         ;;string->list
+         ;;string->vector
          string-allocate
          string-append
          string-capitalize
          string-capitalize!
          string-capitalized?
-         string-ci-hash
-         string-ci<=?
-         string-ci<?
-         string-ci=?
-         string-ci>=?
-         string-ci>?
+         ;; string-ci-hash
+         ;; string-ci<=?
+         ;; string-ci<?
+         ;; string-ci=?
+         ;; string-ci>=?
+         ;; string-ci>?
          string-compare
          string-compare-ci
          string-copy
@@ -1085,8 +1085,8 @@ USA.
          string-find-previous-char-ci
          string-find-previous-char-in-set
          string-for-each
-         string-hash
-         string-hash-mod
+         ;; string-hash
+         ;; string-hash-mod
          string-head
          string-head!
          string-joiner
@@ -1122,11 +1122,11 @@ USA.
          string-upcase
          string-upcase!
          string-upper-case?
-         string<=?
-         string<?
-         string=?
-         string>=?
-         string>?
+         ;; string<=?
+         ;; string<?
+         ;; string=?
+         ;; string>=?
+         ;; string>?
          string?
          substring
          substring->list
@@ -1170,6 +1170,22 @@ USA.
   (files "ustring")
   (parent (runtime))
   (export ()
+         (list->string list->ustring)
+         (string->list ustring->list)
+         (string->vector ustring->vector)
+         (string-ci-hash ustring-ci-hash)
+         (string-ci<=? ustring-ci<=?)
+         (string-ci<? ustring-ci<?)
+         (string-ci=? ustring-ci=?)
+         (string-ci>=? ustring-ci>=?)
+         (string-ci>? ustring-ci>?)
+         (string-hash ustring-hash)
+         (string-hash-mod ustring-hash)
+         (string<=? ustring<=?)
+         (string<? ustring<?)
+         (string=? ustring=?)
+         (string>=? ustring>=?)
+         (string>? ustring>?)
          (usubstring ustring-copy)
          list->ustring
          make-ustring
@@ -1186,6 +1202,7 @@ USA.
          ustring-ci=?
          ustring-ci>=?
          ustring-ci>?
+         ustring-ci-hash
          ustring-copy
          ustring-copy!
          ustring-downcase
index 677f569b4f92837439a6763a7b04ff923d3411f4..493e59c5d4a7312aa91532ae4935a95986fb33c3 100644 (file)
@@ -614,6 +614,9 @@ USA.
        ((ucode-primitive string-hash) string*)
        ((ucode-primitive string-hash-mod) string* modulus))))
 
+(define (ustring-ci-hash string #!optional modulus)
+  (ustring-hash (ustring-foldcase string) modulus))
+
 (define (ustring->legacy-string string)
   (if (legacy-string? string)
       string