Eliminate style-warning about undefined type GLOBAL-VAR
[sbcl.git] / src / code / alien-type.lisp
blobd63d5320a3e663db95c898a6842ce2feadcc65fc
1 ;;;; ALIEN-related type system stuff, done later
2 ;;;; than other type system stuff because it depends on the definition
3 ;;;; of the ALIEN-VALUE target structure type
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
14 (in-package "SB!KERNEL")
16 (/show0 "code/alien-type.lisp 16")
18 (!begin-collecting-cold-init-forms)
20 (!define-type-class alien :enumerable nil :might-contain-other-types nil)
22 (!define-type-method (alien :negate) (type)
23 (make-negation-type :type type))
25 (!define-type-method (alien :unparse) (type)
26 `(alien ,(unparse-alien-type (alien-type-type-alien-type type))))
28 (!define-type-method (alien :simple-subtypep) (type1 type2)
29 (values (alien-subtype-p (alien-type-type-alien-type type1)
30 (alien-type-type-alien-type type2))
31 t))
33 ;;; KLUDGE: This !DEFINE-SUPERCLASSES gets executed much later than the
34 ;;; others (toplevel form time instead of cold load init time) because
35 ;;; ALIEN-VALUE itself is a structure which isn't defined until fairly
36 ;;; late.
37 (!define-superclasses alien ((alien-value)) progn)
39 (!define-type-method (alien :simple-=) (type1 type2)
40 (let ((alien-type-1 (alien-type-type-alien-type type1))
41 (alien-type-2 (alien-type-type-alien-type type2)))
42 (values (or (eq alien-type-1 alien-type-2)
43 (alien-type-= alien-type-1 alien-type-2))
44 t)))
46 (!def-type-translator alien (&optional (alien-type nil))
47 (typecase alien-type
48 (null
49 (make-alien-type-type))
50 (alien-type
51 (make-alien-type-type alien-type))
53 (make-alien-type-type (parse-alien-type alien-type (make-null-lexenv))))))
55 (defun make-alien-type-type (&optional alien-type)
56 (if alien-type
57 (let ((lisp-rep-type (compute-lisp-rep-type alien-type)))
58 (if lisp-rep-type
59 (single-value-specifier-type lisp-rep-type)
60 (%make-alien-type-type alien-type)))
61 *universal-type*))
63 (!defun-from-collected-cold-init-forms !alien-type-cold-init)
65 (/show0 "code/alien-type.lisp end of file")