Raymond Toy pushed to branch issue-318-add-concrete-standard-char-type at cmucl / cmucl
Commits:
-
3dfca652
by Raymond Toy at 2026-06-26T08:51:40-07:00
-
7d0efaa6
by Raymond Toy at 2026-06-26T08:51:40-07:00
-
2302c6bc
by Raymond Toy at 2026-06-26T08:51:40-07:00
-
fecdd641
by Raymond Toy at 2026-06-26T08:51:40-07:00
-
a4842b2f
by Raymond Toy at 2026-06-26T08:51:40-07:00
4 changed files:
Changes:
| ... | ... | @@ -38,7 +38,7 @@ ENABLE2="yes" |
| 38 | 38 | ENABLE3="yes"
|
| 39 | 39 | ENABLE4="yes"
|
| 40 | 40 | |
| 41 | -version=21f
|
|
| 41 | +version=21e
|
|
| 42 | 42 | SRCDIR=src
|
| 43 | 43 | BINDIR=bin
|
| 44 | 44 | TOOLDIR=$BINDIR
|
| 1 | -;; For #318. Define new standard-char type.
|
|
| 2 | -(in-package "KERNEL")
|
|
| 3 | -(ext:without-package-locks
|
|
| 4 | -(define-type-class standard-char)
|
|
| 5 | -(defstruct (standard-char-type
|
|
| 6 | - (:include ctype
|
|
| 7 | - (class-info (type-class-or-lose 'standard-char))
|
|
| 8 | - (:enumerable t))
|
|
| 9 | - (:constructor %make-standard-char-type ())
|
|
| 10 | - (:copier nil)))
|
|
| 11 | - |
|
| 12 | -(defun make-standard-char-type ()
|
|
| 13 | - (%make-standard-char-type))
|
|
| 14 | -) |
| ... | ... | @@ -3347,7 +3347,10 @@ |
| 3347 | 3347 | (values t t))
|
| 3348 | 3348 | ((member-type-p type2)
|
| 3349 | 3349 | ;; If TYPE2 is a member-type, check whether it contains all standard-chars
|
| 3350 | - (values (subsetp +standard-chars+ (member-type-members type2))
|
|
| 3350 | + (values (let ((members (member-type-members type2)))
|
|
| 3351 | + (every #'(lambda (c)
|
|
| 3352 | + (member c members))
|
|
| 3353 | + +standard-chars+))
|
|
| 3351 | 3354 | t))
|
| 3352 | 3355 | (t
|
| 3353 | 3356 | (values nil t))))
|
| ... | ... | @@ -3358,7 +3361,9 @@ |
| 3358 | 3361 | (cond ((member-type-p type1)
|
| 3359 | 3362 | ;; If TYPE1 is a member-type, check whether it contains all
|
| 3360 | 3363 | ;; standard-chars.
|
| 3361 | - (values (subsetp (member-type-members type1) +standard-chars+)
|
|
| 3364 | + (values (every #'(lambda (c)
|
|
| 3365 | + (member c +standard-chars+))
|
|
| 3366 | + (member-type-members type1))
|
|
| 3362 | 3367 | t))
|
| 3363 | 3368 | (t
|
| 3364 | 3369 | (values nil t))))
|
| ... | ... | @@ -3374,8 +3379,10 @@ |
| 3374 | 3379 | ((csubtypep (specifier-type 'character) other)
|
| 3375 | 3380 | other)
|
| 3376 | 3381 | ((and (member-type-p other)
|
| 3377 | - (subsetp (member-type-members other)
|
|
| 3378 | - +standard-chars+))
|
|
| 3382 | + ;; Check to see every member of OTHER is a STANDARD-CHAR.
|
|
| 3383 | + (every #'(lambda (c)
|
|
| 3384 | + (member c +standard-chars+))
|
|
| 3385 | + (member-type-members other)))
|
|
| 3379 | 3386 | sc)
|
| 3380 | 3387 | (t nil))))
|
| 3381 | 3388 | |
| ... | ... | @@ -3640,16 +3647,6 @@ |
| 3640 | 3647 | "Type of characters that aren't base-char's. None in CMU CL."
|
| 3641 | 3648 | '(and character (not base-char)))
|
| 3642 | 3649 | |
| 3643 | -#+nil
|
|
| 3644 | -(deftype standard-char ()
|
|
| 3645 | - "Type corresponding to the charaters required by the standard."
|
|
| 3646 | - '(member #\NEWLINE #\SPACE #\! #\" #\# #\$ #\% #\& #\' #\( #\) #\* #\+ #\,
|
|
| 3647 | - #\- #\. #\/ #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\: #\; #\< #\=
|
|
| 3648 | - #\> #\? #\@ #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M
|
|
| 3649 | - #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z #\[ #\\ #\]
|
|
| 3650 | - #\^ #\_ #\` #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m
|
|
| 3651 | - #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z #\{
|
|
| 3652 | - #\| #\} #\~))
|
|
| 3653 | 3650 | (deftype keyword ()
|
| 3654 | 3651 | "Type for any keyword symbol."
|
| 3655 | 3652 | '(and symbol (satisfies keywordp)))
|
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | ;; sure we test the intersection and union methods for standard-char.
|
| 11 | 11 | |
| 12 | 12 | (define-test standard-char.typep
|
| 13 | - (:tag :issues)
|
|
| 13 | + (:tag :issues)
|
|
| 14 | 14 | (assert-true (typep #\a 'standard-char))
|
| 15 | 15 | (assert-false (typep #\tab 'standard-char))
|
| 16 | 16 | (assert-true (typep #\Z 'standard-char))
|
| ... | ... | @@ -24,8 +24,12 @@ |
| 24 | 24 | |
| 25 | 25 | (assert-equal (values t t)
|
| 26 | 26 | (subtypep 'standard-char 'character))
|
| 27 | + (assert-equal (values nil t)
|
|
| 28 | + (subtypep 'character 'standard-char))
|
|
| 27 | 29 | (assert-equal (values t t)
|
| 28 | - (subtypep 'standard-char 'base-char)))
|
|
| 30 | + (subtypep 'standard-char 'base-char))
|
|
| 31 | + (assert-equal (values nil t)
|
|
| 32 | + (subtypep 'base-char 'standard-char)))
|
|
| 29 | 33 | |
| 30 | 34 | (define-test standard-char.etypecase-15
|
| 31 | 35 | (:tag :issues)
|