Raymond Toy pushed to branch issue-326-char-casing-cleanup at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/char.lisp
    ... ... @@ -31,7 +31,6 @@
    31 31
     	  alphanumericp char= char/= char< char> char<= char>= char-equal
    
    32 32
     	  char-not-equal char-lessp char-greaterp char-not-greaterp
    
    33 33
     	  char-not-lessp character char-code code-char char-upcase
    
    34
    -	  char-titlecase title-case-p
    
    35 34
     	  char-downcase digit-char char-int char-name name-char
    
    36 35
     	  codepoint-limit codepoint))
    
    37 36
     
    
    ... ... @@ -298,17 +297,6 @@
    298 297
     	(and (> m +ascii-limit+)
    
    299 298
                  (not (zerop (ldb +upper-case-entry+ (case-mapping-entry m))))))))
    
    300 299
     
    
    301
    -(defun title-case-p (char)
    
    302
    -  "The argument must be a character object; title-case-p returns T if the
    
    303
    -  argument is a title-case character, NIL otherwise."
    
    304
    -  (declare (character char))
    
    305
    -  (let ((m (char-code char)))
    
    306
    -    (or (< 64 m 91)
    
    307
    -	#+(and unicode (not unicode-bootstrap))
    
    308
    -	(and (> m +ascii-limit+)
    
    309
    -	     (= (unicode-category m) +unicode-category-title+)))))
    
    310
    -
    
    311
    -
    
    312 300
     (defun both-case-p (char)
    
    313 301
       "The argument must be a character object.  Both-case-p returns T if the
    
    314 302
       argument is an alphabetic character and if the character exists in
    
    ... ... @@ -504,20 +492,6 @@
    504 492
       (declare (character char))
    
    505 493
       (char-upcase char))
    
    506 494
     
    
    507
    -(defun char-titlecase (char)
    
    508
    -  "Returns CHAR converted to title-case if that is possible."
    
    509
    -  (declare (character char))
    
    510
    -  #-(and unicode (not unicode-bootstrap))
    
    511
    -  (if (lower-case-p char)
    
    512
    -      (code-char (- (char-code char) 32))
    
    513
    -      char)
    
    514
    -  #+(and unicode (not unicode-bootstrap))
    
    515
    -  (let ((m (char-code char)))
    
    516
    -    (cond ((> m +ascii-limit+) (code-char (unicode-title m)))
    
    517
    -	  ((< (char-code #\`) m (char-code #\{))
    
    518
    -           (code-char (- m 32)))
    
    519
    -	  (t char))))
    
    520
    -
    
    521 495
     (defun char-downcase (char)
    
    522 496
       "Returns CHAR converted to lower-case if that is possible."
    
    523 497
       (declare (character char))
    

  • src/code/unicode.lisp
    ... ... @@ -398,6 +398,30 @@
    398 398
     	       (declare (ignore c))
    
    399 399
     	       (lookup (+ i (if (eql widep 1) 2 1)) (left-context i))))))))
    
    400 400
     
    
    401
    +(defun char-titlecase (char)
    
    402
    +  "Returns CHAR converted to title-case if that is possible."
    
    403
    +  (declare (character char))
    
    404
    +  #-(and unicode (not unicode-bootstrap))
    
    405
    +  (if (lower-case-p char)
    
    406
    +      (code-char (- (char-code char) 32))
    
    407
    +      char)
    
    408
    +  #+(and unicode (not unicode-bootstrap))
    
    409
    +  (let ((m (char-code char)))
    
    410
    +    (cond ((> m +ascii-limit+) (code-char (unicode-title m)))
    
    411
    +	  ((< (char-code #\`) m (char-code #\{))
    
    412
    +           (code-char (- m 32)))
    
    413
    +	  (t char))))
    
    414
    +
    
    415
    +(defun title-case-p (char)
    
    416
    +  "The argument must be a character object; title-case-p returns T if the
    
    417
    +  argument is a title-case character, NIL otherwise."
    
    418
    +  (declare (character char))
    
    419
    +  (let ((m (char-code char)))
    
    420
    +    (or (< 64 m 91)
    
    421
    +	#+(and unicode (not unicode-bootstrap))
    
    422
    +	(and (> m +ascii-limit+)
    
    423
    +	     (= (unicode-category m) +unicode-category-title+)))))
    
    424
    +
    
    401 425
     (defun string-capitalize-unicode (string &key (start 0) end (casing :simple))
    
    402 426
       "Capitalize String using the Unicode word-break algorithm to find
    
    403 427
       the words in String.  The beginning is capitalized depending on the