X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Falien-type.lisp;h=b0aeb651a86207b97687ec878930d54cec761d4e;hb=0c3bbfaa2286626a2d915c8810f690aefc702661;hp=40e3ea14fd4eab59e7691f6b12c82dcb81f195dd;hpb=77360ee4a1f94c41b807be7ad0e8687199fceef1;p=sbcl.git diff --git a/src/code/alien-type.lisp b/src/code/alien-type.lisp index 40e3ea1..b0aeb65 100644 --- a/src/code/alien-type.lisp +++ b/src/code/alien-type.lisp @@ -13,41 +13,42 @@ (in-package "SB!KERNEL") +(/show0 "code/alien-type.lisp 16") + (!begin-collecting-cold-init-forms) (defstruct (alien-type-type - (:include ctype - (class-info (type-class-or-lose 'alien))) - (:constructor %make-alien-type-type (alien-type))) + (:include ctype + (class-info (type-class-or-lose 'alien))) + (:constructor %make-alien-type-type (alien-type)) + (:copier nil)) (alien-type nil :type alien-type)) (!define-type-class alien) +(!define-type-method (alien :negate) (type) + (make-negation-type :type type)) + (!define-type-method (alien :unparse) (type) `(alien ,(unparse-alien-type (alien-type-type-alien-type type)))) (!define-type-method (alien :simple-subtypep) (type1 type2) (values (alien-subtype-p (alien-type-type-alien-type type1) - (alien-type-type-alien-type type2)) - t)) + (alien-type-type-alien-type type2)) + t)) ;;; KLUDGE: This !DEFINE-SUPERCLASSES gets executed much later than the ;;; others (toplevel form time instead of cold load init time) because ;;; ALIEN-VALUE itself is a structure which isn't defined until fairly ;;; late. -;;; -;;; FIXME: I'm somewhat tempted to just punt ALIEN from the type system. -;;; It's sufficiently unlike the others that it's a bit of a pain, and -;;; it doesn't seem to be put to any good use either in type inference or -;;; in type declarations. (!define-superclasses alien ((alien-value)) progn) (!define-type-method (alien :simple-=) (type1 type2) (let ((alien-type-1 (alien-type-type-alien-type type1)) - (alien-type-2 (alien-type-type-alien-type type2))) + (alien-type-2 (alien-type-type-alien-type type2))) (values (or (eq alien-type-1 alien-type-2) - (alien-type-= alien-type-1 alien-type-2)) - t))) + (alien-type-= alien-type-1 alien-type-2)) + t))) (!def-type-translator alien (&optional (alien-type nil)) (typecase alien-type @@ -61,9 +62,11 @@ (defun make-alien-type-type (&optional alien-type) (if alien-type (let ((lisp-rep-type (compute-lisp-rep-type alien-type))) - (if lisp-rep-type - (specifier-type lisp-rep-type) - (%make-alien-type-type alien-type))) + (if lisp-rep-type + (single-value-specifier-type lisp-rep-type) + (%make-alien-type-type alien-type))) *universal-type*)) (!defun-from-collected-cold-init-forms !alien-type-cold-init) + +(/show0 "code/alien-type.lisp end of file")