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

Commits:

2 changed files:

Changes:

  • src/code/char.lisp
    ... ... @@ -258,7 +258,7 @@
    258 258
       (declare (character char))
    
    259 259
       (and (typep char 'base-char)
    
    260 260
            (let ((m (char-code (the base-char char))))
    
    261
    -	 (or (< 31 m 127)
    
    261
    +	 (or (<= (char-code #\space ) m (char-code #\~))
    
    262 262
     	     #+(and unicode (not unicode-bootstrap))
    
    263 263
     	     (and (> m +ascii-limit+)
    
    264 264
     		  (>= (unicode-category m) +unicode-category-graphic+))))))
    
    ... ... @@ -269,7 +269,8 @@
    269 269
       argument is an alphabetic character; otherwise NIL."
    
    270 270
       (declare (character char))
    
    271 271
       (let ((m (char-code char)))
    
    272
    -    (or (< 64 m 91) (< 96 m 123)
    
    272
    +    (or (<= (char-code #\A) m (char-code #\Z))
    
    273
    +        (<= (char-code #\a) m (char-code #\z))
    
    273 274
     	#+(and unicode (not unicode-bootstrap))
    
    274 275
     	(and (> m +ascii-limit+)
    
    275 276
     	     (<= +unicode-category-letter+ (unicode-category m)
    
    ... ... @@ -281,7 +282,7 @@
    281 282
       argument is an upper-case character, NIL otherwise."
    
    282 283
       (declare (character char))
    
    283 284
       (let ((m (char-code char)))
    
    284
    -    (or (< 64 m 91)
    
    285
    +    (or (<= (char-code #\A) m (char-code #\Z))
    
    285 286
     	#+(and unicode (not unicode-bootstrap))
    
    286 287
     	(and (> m +ascii-limit+)
    
    287 288
                  (not (zerop (ldb +lower-case-entry+ (case-mapping-entry m))))))))
    
    ... ... @@ -292,7 +293,7 @@
    292 293
       argument is a lower-case character, NIL otherwise."
    
    293 294
       (declare (character char))
    
    294 295
       (let ((m (char-code char)))
    
    295
    -    (or (< 96 m 123)
    
    296
    +    (or (<= (char-code #\a) m (char-code #\z))
    
    296 297
     	#+(and unicode (not unicode-bootstrap))
    
    297 298
     	(and (> m +ascii-limit+)
    
    298 299
                  (not (zerop (ldb +upper-case-entry+ (case-mapping-entry m))))))))
    
    ... ... @@ -303,7 +304,8 @@
    303 304
       both upper and lower case.  For ASCII, this is the same as Alpha-char-p."
    
    304 305
       (declare (character char))
    
    305 306
       (let ((m (char-code char)))
    
    306
    -    (or (< 64 m 91) (< 96 m 123)
    
    307
    +    (or (<= (char-code #\A) m (char-code #\Z))
    
    308
    +        (<= (char-code #\a) m (char-code #\z))
    
    307 309
     	#+(and unicode (not unicode-bootstrap))
    
    308 310
     	(and (> m +ascii-limit+)
    
    309 311
                  (not (zerop (case-mapping-entry m)))))))
    
    ... ... @@ -335,7 +337,9 @@
    335 337
       (declare (character char))
    
    336 338
       (let ((m (char-code char)))
    
    337 339
         ;; Shortcut for ASCII digits and upper and lower case ASCII letters
    
    338
    -    (or (< 47 m 58) (< 64 m 91) (< 96 m 123)
    
    340
    +    (or (<= (char-code #\0) m (char-code #\9))
    
    341
    +        (<= (char-code #\A) m (char-code #\Z))
    
    342
    +        (<= (char-code #\a) m (char-code #\z))
    
    339 343
     	#+(and unicode (not unicode-bootstrap))
    
    340 344
     	(and (> m +ascii-limit+)
    
    341 345
     	     (<= +unicode-category-letter+ (unicode-category m)
    

  • src/compiler/srctran.lisp
    ... ... @@ -3343,7 +3343,7 @@
    3343 3343
            x)
    
    3344 3344
       #+(and unicode (not unicode-bootstrap))
    
    3345 3345
       '(let ((m (char-code x)))
    
    3346
    -    (cond ((< (char-code #\`) m (char-code #\{))
    
    3346
    +    (cond ((<= (char-code #\a) m (char-code #\z))
    
    3347 3347
                (code-char (logxor m #x20)))
    
    3348 3348
               ((> m lisp::+ascii-limit+)
    
    3349 3349
                (code-char (lisp::case-mapping-upper-case m)))
    
    ... ... @@ -3357,7 +3357,7 @@
    3357 3357
            x)
    
    3358 3358
       #+(and unicode (not unicode-bootstrap))
    
    3359 3359
       '(let ((m (char-code x)))
    
    3360
    -    (cond ((< (char-code #\@) m (char-code #\[))
    
    3360
    +    (cond ((<= (char-code #\A) m (char-code #\Z))
    
    3361 3361
                (code-char (logxor m #x20)))
    
    3362 3362
               ((> m lisp::+ascii-limit+)
    
    3363 3363
                (code-char (lisp::case-mapping-lower-case m)))