Raymond Toy pushed to branch issue-323-cl-string-casing at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/unicode.lisp
    ... ... @@ -21,7 +21,7 @@
    21 21
       _N"Given a string, returns a new string that is a copy of it with all
    
    22 22
       lower case alphabetic characters converted to uppercase."
    
    23 23
       (declare (fixnum start))
    
    24
    -  (let* ((string (if (stringp string) string (string string)))
    
    24
    +  (let* ((string (string string))
    
    25 25
     	 (slen (length string)))
    
    26 26
         (declare (fixnum slen))
    
    27 27
         (lisp::with-one-string string start end offset
    
    ... ... @@ -66,8 +66,8 @@
    66 66
       _N"Given a string, returns a new string that is a copy of it with
    
    67 67
       all lower case alphabetic characters converted to uppercase using
    
    68 68
       full case conversion."
    
    69
    -  (declare (fixnum start)) (let* ((string (if
    
    70
    -  (stringp string) string (string string)))
    
    69
    +  (declare (fixnum start))
    
    70
    +  (let* ((string (string string))
    
    71 71
     	 (slen (length string)))
    
    72 72
         (declare (fixnum slen))
    
    73 73
         (with-output-to-string (s)
    
    ... ... @@ -100,10 +100,13 @@
    100 100
       all lower case alphabetic characters converted to uppercase.  Casing
    
    101 101
       is :simple or :full for simple or full case conversion,
    
    102 102
       respectively."
    
    103
    -  (declare (fixnum start))
    
    104
    -  (if (eq casing :simple)
    
    105
    -      (string-upcase-simple string :start start :end end)
    
    106
    -      (string-upcase-full string :start start :end end)))
    
    103
    +  (declare (fixnum start)
    
    104
    +           (type (member :simple :full) casing))
    
    105
    +  (ecase casing
    
    106
    +    (:simple
    
    107
    +     (string-upcase-simple string :start start :end end))
    
    108
    +    (:full
    
    109
    +     (string-upcase-full string :start start :end end))))
    
    107 110
     
    
    108 111
     (defun string-downcase-simple (string &key (start 0) end)
    
    109 112
       _N"Given a string, returns a new string that is a copy of it with all
    
    ... ... @@ -188,10 +191,13 @@
    188 191
       uppercase alphabetic characters converted to lowercase.  Casing is
    
    189 192
       :simple or :full for simple or full case conversion, respectively."
    
    190 193
     
    
    191
    -  (declare (fixnum start))
    
    192
    -  (if (eq casing :simple)
    
    193
    -      (string-downcase-simple string :start start :end end)
    
    194
    -      (string-downcase-full string :start start :end end)))
    
    194
    +  (declare (fixnum start)
    
    195
    +           (type (member :simple :full) casing))
    
    196
    +  (ecase casing
    
    197
    +    (:simple
    
    198
    +     (string-downcase-simple string :start start :end end))
    
    199
    +    (:full
    
    200
    +     (string-downcase-full string :start start :end end))))
    
    195 201
     
    
    196 202
     
    
    197 203
     ;;;
    
    ... ... @@ -637,12 +643,14 @@
    637 643
       delimited by non-case-modifiable chars.  "
    
    638 644
     
    
    639 645
       (declare (fixnum start)
    
    640
    -	   (type (member :simple :full :title) casing))
    
    646
    +	   (type (member :simple-title :simple :full :title) casing))
    
    641 647
       (if unicode-word-break
    
    642 648
           (string-capitalize-unicode string :start start :end end :casing casing)
    
    643
    -      (if (eq casing :simple)
    
    644
    -	  (string-capitalize-simple string :start start :end end)
    
    645
    -	  (string-capitalize-full string :start start :end end :casing casing))))
    
    649
    +      (ecase casing
    
    650
    +        (:simple-title
    
    651
    +	 (string-capitalize-simple string :start start :end end))
    
    652
    +        ((:simple :full :title)
    
    653
    +	 (string-capitalize-full string :start start :end end :casing casing)))))
    
    646 654
     
    
    647 655
     
    
    648 656
     (defun decompose-hangul-syllable (cp stream)