Initial revision
[sbcl.git] / src / pcl / early-low.lisp
1 ;;;; some code pulled out of CMU CL's low.lisp to solve build order problems,
2 ;;;; and some other stuff that just plain needs to be done early
3
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6
7 ;;;; This software is derived from software originally released by Xerox
8 ;;;; Corporation. Copyright and release statements follow. Later modifications
9 ;;;; to the software are in the public domain and are provided with
10 ;;;; absolutely no warranty. See the COPYING and CREDITS files for more
11 ;;;; information.
12
13 ;;;; copyright information from original PCL sources:
14 ;;;;
15 ;;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990 Xerox Corporation.
16 ;;;; All rights reserved.
17 ;;;;
18 ;;;; Use and copying of this software and preparation of derivative works based
19 ;;;; upon this software are permitted. Any distribution of this software or
20 ;;;; derivative works must comply with all applicable United States export
21 ;;;; control laws.
22 ;;;;
23 ;;;; This software is made available AS IS, and Xerox Corporation makes no
24 ;;;; warranty about the software, its performance or its conformity to any
25 ;;;; specification.
26
27 (sb-int:file-comment
28   "$Header$")
29
30 (in-package "SB-PCL")
31 \f
32 ;;; FIXME: The PCL package is internal and is used by code in potential
33 ;;; bottlenecks. Access to it might be faster through #.(find-package "SB-PCL")
34 ;;; than through *PCL-PACKAGE*. And since it's internal, no one should be
35 ;;; doing things like deleting and recreating it in a running target Lisp.
36 ;;; So perhaps we should replace it uses of *PCL-PACKAGE* with uses of
37 ;;; (PCL-PACKAGE), and make PCL-PACKAGE a macro which expands into
38 ;;; the SB-PCL package itself. Maybe we should even use this trick for
39 ;;; COMMON-LISP and KEYWORD, too. (And the definition of PCL-PACKAGE etc.
40 ;;; could be made less viciously brittle when SB-FLUID.)
41 ;;; (Or perhaps just define a macro
42 ;;;   (DEFMACRO PKG (NAME)
43 ;;;     #!-SB-FLUID (FIND-PACKAGE NAME)
44 ;;;     #!+SB-FLUID `(FIND-PACKAGE ,NAME))
45 ;;; and use that to replace all three variables.)
46 (defvar *pcl-package*                (find-package "SB-PCL"))
47 (defvar *slot-accessor-name-package* (find-package "SB-SLOT-ACCESSOR-NAME"))
48
49 ;;; This excludes structure types created with the :TYPE option to
50 ;;; DEFSTRUCT. It also doesn't try to deal with types created by
51 ;;; hairy DEFTYPEs, e.g.
52 ;;;   (DEFTYPE CACHE-STRUCTURE (SIZE)
53 ;;;     (IF (> SIZE 11) 'BIG-CS 'SMALL-CS)).
54 ;;; KLUDGE: In fact, it doesn't seem to deal with DEFTYPEs at all. Perhaps
55 ;;; it needs a more mnemonic name. -- WHN 19991204
56 (defun structure-type-p (type)
57   (and (symbolp type)
58        (let ((class  (cl:find-class type nil)))
59          (and class
60               (typep (sb-kernel:layout-info (sb-kernel:class-layout class))
61                      'sb-kernel:defstruct-description)))))