1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB-KERNEL")
12 ;;;; the DEF!TYPE macro
14 ;;; DEF!TYPE = cold DEFTYPE, a version of DEFTYPE which at
15 ;;; build-the-cross-compiler time defines its macro both in the
16 ;;; cross-compilation host Lisp and in the target Lisp. Basically,
17 ;;; DEF!TYPE does something like
18 ;;; (DEFTYPE SB-XC:FOO ..)
19 ;;; #+SB-XC-HOST (SB-XC:DEFTYPE FOO ..)
20 ;;; except that it also automatically delays the SB-XC:DEFTYPE call,
21 ;;; if necessary, until the cross-compiler's DEFTYPE machinery has been
24 (defvar *delayed-def
!types
* nil
)
26 (defmacro def
!type
(name &rest rest
)
27 ;; Attempting to define a type named by a CL symbol is an error.
28 (assert (not (eq (sb-xc:symbol-package name
) *cl-package
*)))
30 (deftype ,name
,@rest
)
32 ,(let ((form `(sb-xc:deftype
,name
,@rest
)))
33 (if (boundp '*delayed-def
!types
*)
34 `(push ',form
*delayed-def
!types
*)