| 1 |
C CLASS |
| 2 |
SC STANDARD-CLASS |
| 3 |
BIC BUILT-IN-CLASS |
| 4 |
FRC FORWARD-REFERENCED-CLASS |
| 5 |
FSC FUNCALLABLE-STANDARD-CLASS |
| 6 |
M METHOD |
| 7 |
SM STANDARD-METHOD |
| 8 |
SAM STANDARD-ACCESSOR-METHOD |
| 9 |
GF GENERIC-FUNCTION |
| 10 |
SGF STANDARD-GENERIC-FUNCTION |
| 11 |
SP SPECIALIZER |
| 12 |
EQSP EQL-SPECIALIZER |
| 13 |
SD SLOT-DEFINITION |
| 14 |
SSD STANDARD-SLOT-DEFINITION |
| 15 |
SDSD STANDARD-DIRECT-SLOT-DEFINITION |
| 16 |
SESF STANDARD-EFFECTIVE-SLOT-DEFINITION |
| 17 |
|
| 18 |
;; |
| 19 |
;; MISCELLANEOUS PROTOCOLS |
| 20 |
;; ======================= |
| 21 |
;; |
| 22 |
|
| 23 |
(ADD-DEPENDENT (metaobject SC FSC SGF) dependent) |
| 24 |
|
| 25 |
(MAP-DEPENDENT (metaobject SC FSC SGF) function) |
| 26 |
|
| 27 |
(REMOVE-DEPENDENT (metaobject SC FSC SGF) dependent) |
| 28 |
|
| 29 |
(UPDATE-DEPENDENT (metaobject SC FSC SGF) |
| 30 |
|
| 31 |
(ALLOCATE-INSTANCE (class SC FSC BIC) &rest initargs) |
| 32 |
|
| 33 |
;; |
| 34 |
;; CLASSES |
| 35 |
;; ======= |
| 36 |
;; |
| 37 |
|
| 38 |
;; |
| 39 |
;; 2.A) GENERAL CLASS ACCESSORS |
| 40 |
;; ----------------------- |
| 41 |
|
| 42 |
(ADD-DIRECT-SUBCLASS (superclass C) (subclass C)) |
| 43 |
|
| 44 |
(REMOVE-DIRECT-SUBCLASS (superclass C) (subclass C)) |
| 45 |
|
| 46 |
(CLASS-DEFAULT-INITARGS (class C)) |
| 47 |
(CLASS-DIRECT-DEFAULT-INITARGS (class C)) |
| 48 |
(CLASS-DIRECT-SLOTS (class C)) |
| 49 |
(CLASS-DIRECT-SUBCLASSES (class C)) |
| 50 |
(CLASS-DIRECT-SUPERCLASSES (class C)) |
| 51 |
(CLASS-FINALIZED-P (class C)) |
| 52 |
(CLASS-NAME (class C)) |
| 53 |
(CLASS-PRECEDENCE-LIST (class C)) |
| 54 |
(CLASS-PROTOTYPE (class C)) |
| 55 |
(CLASS-SLOTS (class C)) |
| 56 |
|
| 57 |
[F] ((SETF CLASS-NAME) new-name class) |
| 58 |
|
| 59 |
[F] (STANDARD-INSTANCE-ACCESS instance location) |
| 60 |
|
| 61 |
[F] (FUNCALLABLE-STANDARD-INSTANCE-ACCESS instance location) |
| 62 |
|
| 63 |
;; |
| 64 |
;; 2.B) CLASS-DEFINITION |
| 65 |
;; ---------------- |
| 66 |
|
| 67 |
[F] (ENSURE-CLASS name &key &allow-other-keys) |
| 68 |
|
| 69 |
(ENSURE-CLASS-USING-CLASS (class (C FRC NULL)) name |
| 70 |
&key :direct-default-initargs :direct-slots :direct-superclasses |
| 71 |
:name (:metaclass 'STANDARD-CLASS) |
| 72 |
&rest initargs |
| 73 |
&allow-other-keys) |
| 74 |
" |
| 75 |
< CLASS is a class metaobject or NIL |
| 76 |
< METACLASS is a class metaobject or a valid name of one (or error). |
| 77 |
< :DIRECT-SUPERCLASSES is a proper list of class metaobjects or names (or error). |
| 78 |
- This function may be called directly, and it is used to define or modify |
| 79 |
the definition of a function. |
| 80 |
- INITARGS is processed: |
| 81 |
- The :METACLASS option is removed. |
| 82 |
- The :DIRECT-SUPERCLASSES is processed, so that each element is |
| 83 |
a valid class metaobject or a forward referenced class metaobject. |
| 84 |
- The METACLASS argument is processed as follows |
| 85 |
+ if CLASS is NIL, an instance of METACLASS is created with the |
| 86 |
computed INITARGS. |
| 87 |
+ if CLASS is a forward referenced class, CHANGE-CLASS is applied on |
| 88 |
it with the value of METACLASS, and it is REINITIALIZE-CLASS with |
| 89 |
the computed INITARGS. |
| 90 |
+ if CLASS <> METACLASS, an error is signaled. |
| 91 |
+ otherwise, CLASS is REINITIALIZE-CLASS with the computed INITARGS. |
| 92 |
" |
| 93 |
|
| 94 |
(MAKE-INSTANCE (class (SYMBOL SC FSC)) &rest initargs) |
| 95 |
|
| 96 |
[M] (INITIALIZE-INSTANCE class &rest initargs) |
| 97 |
[M] (REINITIALIZE-INSTANCE class &rest initargs) |
| 98 |
[M] (SHARED-INITIALIZE class &rest initargs) |
| 99 |
|
| 100 |
" |
| 101 |
- Initialization is made by MAKE-INSTANCE and letting it call |
| 102 |
INITIALIZE-INSTANCE. |
| 103 |
- Reinitialization is made by REINITIALIZE-INSTANCE on an existing class. |
| 104 |
- INITIALZE-INSTANCE, CHANGE-CLASS AND SHARED-INITIALIZE cannot be called |
| 105 |
directly on a class metaobject. |
| 106 |
- SHARED-INITIALIZE cannot be redefined by any user methods. |
| 107 |
- [RE]INITIALIZE-INSTANCE may have extending around methods (i.e. they |
| 108 |
must not override the existing specified methods. |
| 109 |
< :DIRECT-DEFAULT-INITARGS is a proper list of canonicalized default initargs |
| 110 |
(or error). |
| 111 |
< :DIRECT-SLOTS is a proper list of canonicalized slotd definitions (or |
| 112 |
error). |
| 113 |
< :DIRECT-SUPERCLASSES is a proper list of valid class metaobjects (or error) |
| 114 |
Validation is made using VALIDATE-SUPERCLASS. |
| 115 |
< :DOCUMENTATION is either a string or NIL (or error) |
| 116 |
< :NAME is any object |
| 117 |
- Default values during initialization |
| 118 |
DIRECT-DEFAULT-INITARGS => NIL |
| 119 |
DIRECT-SLOTS => NIL |
| 120 |
DIRECT-SUPERCLASSES => (LIST (FIND-CLASS 'STANDARD-OBJECT)) |
| 121 |
or (LIST (FIND-CLASS 'FUNCALLABLE-STANDARD-OBJECT)) |
| 122 |
DOCUMENTATION => NIL |
| 123 |
NAME => NIL |
| 124 |
- DIRECT-SLOTS is converted to a list of slot definition objects |
| 125 |
+ DIRECT-SLOT-DEFINITION-CLASS provides the class |
| 126 |
+ MAKE-INSTANCE is used to create the slot definition |
| 127 |
+ After slots are created, reader and writer methods are created |
| 128 |
using READER-METHOD-CLASS and WRITER-METHOD-CLASS. |
| 129 |
" |
| 130 |
|
| 131 |
(COMPUTE-CLASS-PRECEDENCE-LIST (class C)) |
| 132 |
|
| 133 |
(COMPUTE-DEFAULT-INITARGS (class (SC FSC)) |
| 134 |
|
| 135 |
(VALIDATE-SUPERCLASS (class C) (superclass C)) |
| 136 |
|
| 137 |
(FINALIZE-INHERITANCE (class (SC FSC FRC))) |
| 138 |
|
| 139 |
" |
| 140 |
- This function is called with a class, at least before the first |
| 141 |
invocation of ALLOCATE-INSTANCE. |
| 142 |
- COMPUTE-CLASS-PRECEDENCE-LIST is done, and the value stored. |
| 143 |
- COMPUTE-SLOTS is done and the value stored. It involves calling |
| 144 |
- EFFECTIVE-SLOT-DEFINITION-CLASS |
| 145 |
- COMPUTE-EFFECTIVE-SLOT-DEFINITION |
| 146 |
- COMPUTE-DEFAULT-INITARGS is done and the value stored. |
| 147 |
- If the class was previously finalized, and the local slots have |
| 148 |
changed MAKE-INSTANCES-OBSOLETE is invoked. |
| 149 |
- FINALIZE-INHERITANCE signals an error with forward referenced classes. |
| 150 |
" |
| 151 |
|
| 152 |
;; |
| 153 |
;; 2.C) SLOT ALLOCATION AND DEFINITION |
| 154 |
;; ------------------------------ |
| 155 |
|
| 156 |
(COMPUTE-EFFECTIVE-SLOT-DEFINITION (class (SC FSC)) name direct-slot-definitions) |
| 157 |
|
| 158 |
(COMPUTE-SLOTS (class (SC FSC))) |
| 159 |
(COMPUTE-SLOTS :AROUND (class (SC FSC))) |
| 160 |
|
| 161 |
(DIRECT-SLOT-DEFINITION-CLASS (class (SC FSC)) &rest initargs) |
| 162 |
|
| 163 |
(EFFECTIVE-SLOT-DEFINITION-CLASS (class (SC FSC)) &rest initargs) |
| 164 |
|
| 165 |
;; |
| 166 |
;; 2.D) SLOT ACCESSING |
| 167 |
;; -------------- |
| 168 |
;; |
| 169 |
|
| 170 |
((SETF SLOT-VALUE-USING-CLASS) new-value (class (SC FSC BIC)) object (slot SESD)) |
| 171 |
|
| 172 |
(SLOT-BOUNDP-USING-CLASS) (class SC FSC BIC) object (slot SESD)) |
| 173 |
|
| 174 |
(SLOT-MAKUNBOUND-USING-CLASS) (class SC FSC BIC) object (slot SESD)) |
| 175 |
|
| 176 |
(SLOT-VALUE-USING-CLASS (class SC FSC BIC) object (slot SESD)) |
| 177 |
|
| 178 |
;; |
| 179 |
;; SLOTS |
| 180 |
;; ===== |
| 181 |
;; |
| 182 |
|
| 183 |
(SLOT-DEFINITION-ALLOCATION (slotd SSD)) |
| 184 |
(SLOT-DEFINITION-INITARGS (slotd SSD)) |
| 185 |
(SLOT-DEFINITION-INITFORM (slotd SSD)) |
| 186 |
(SLOT-DEFINITION-INITFUNCTION (slotd SSD)) |
| 187 |
(SLOT-DEFINITION-NAME (slotd SSD)) |
| 188 |
(SLOT-DEFINITION-TYPE (slotd SSD)) |
| 189 |
(SLOT-DEFINITION-READERS (direct-slot SDSD)) |
| 190 |
(SLOT-DEFINITION-WRITERS (direct-slot SDSD)) |
| 191 |
(SLOT-DEFINITION-LOCATION (effective-slot SESD)) |
| 192 |
|
| 193 |
;; |
| 194 |
;; SPECIALIZERS |
| 195 |
;; ============ |
| 196 |
;; |
| 197 |
|
| 198 |
(ADD-DIRECT-METHOD (specializer C EQSP) (method M)) |
| 199 |
|
| 200 |
(REMOVE-DIRECT-METHOD (specializer C EQSP) (method M)) |
| 201 |
|
| 202 |
[F] (EQL-SPECIALIZER-OBJECT eql-specializer) |
| 203 |
|
| 204 |
(SPECIALIZER-DIRECT-GENERIC-FUNCTIONS (specializer C EQSP)) |
| 205 |
|
| 206 |
(SPECIALIZER-DIRECT-METHODS (specializer C EQSP)) |
| 207 |
|
| 208 |
;; |
| 209 |
;; GENERIC FUNCTIONS |
| 210 |
;; ================= |
| 211 |
;; |
| 212 |
|
| 213 |
(ADD-METHOD (gf SGF) (method SM)) |
| 214 |
|
| 215 |
(COMPUTE-APPLICABLE-METHODS (gf SGF) arguments) |
| 216 |
|
| 217 |
(COMPUTE-APPLICABLE-METHODS-USING-CLASSES (gf SGF) classes) |
| 218 |
|
| 219 |
(COMPUTE-DISCRIMINATING-FUNCTION (gf SGF)) |
| 220 |
|
| 221 |
(COMPUTE-EFFECTIVE-METHOD (gf SGF) method-combination methods) |
| 222 |
|
| 223 |
[F] (ENSURE-GENERIC-FUNCTION function-name &key &alow-other-keys) |
| 224 |
|
| 225 |
(ENSURE-GENERIC-FUNCTION-USING-CLASS (gf (GF NULL)) function-name |
| 226 |
&key :argument-precedence-order :declarations :documentation |
| 227 |
:generic-function-class :lambda-list :method-class |
| 228 |
:method-combination :name |
| 229 |
&alow-other-keys) |
| 230 |
|
| 231 |
[F] (EXTRACT-LAMBDA-LIST specialized-lambda-list) |
| 232 |
|
| 233 |
[F] (EXTRACT-SPECIALIZER-NAMES specialized-lambda-list) |
| 234 |
|
| 235 |
(FIND-METHOD-COMBINATION gf method-combination-type-name method-combination-options) |
| 236 |
|
| 237 |
[F] (FUNCALLABLE-STANDARD-INSTANCE-ACCESS instance location) |
| 238 |
|
| 239 |
(GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER (gf SGF)) |
| 240 |
(GENERIC-FUNCTION-DECLARATIONS (gf SGF)) |
| 241 |
(GENERIC-FUNCTION-LAMBDA-LIST (gf SGF)) |
| 242 |
(GENERIC-FUNCTION-METHOD-CLASS (gf SGF)) |
| 243 |
(GENERIC-FUNCTION-METHOD-COMBINATION (gf SGF)) |
| 244 |
(GENERIC-FUNCTION-METHODS (gf SGF)) |
| 245 |
(GENERIC-FUNCTION-NAME (gf SGF)) |
| 246 |
|
| 247 |
[F] (INTERN-EQL-SPECIALIZER object) |
| 248 |
|
| 249 |
(MAKE-METHOD-LAMBDA (gf SGF) (method SM) lambda-expression environment) |
| 250 |
|
| 251 |
(MAP-DEPENDENT (metaobject (SC FSC SGF)) function) |
| 252 |
|
| 253 |
(METHOD-FUNCTION (method SM)) |
| 254 |
(METHOD-GENERIC-FUNCTION (method SM)) |
| 255 |
(METHOD-LAMBDA-LIST (method SM)) |
| 256 |
(METHOD-SPECIALIZERS (method SM)) |
| 257 |
(METHOD-QUALIFIERS (method SM)) |
| 258 |
(ACCESSOR-METHOD-SLOT-DEFINITION (method SAM)) |
| 259 |
|
| 260 |
(READER-METHOD-CLASS (class (SC FSC)) (direct-slot SDSD) &rest initargs) |
| 261 |
|
| 262 |
(REMOVE-METHOD (gf SGF) (method SM)) |
| 263 |
|
| 264 |
[F] (SET-FUNCALLABLE-INSTANCE-FUNCTION funcallable-instance function) |
| 265 |
|
| 266 |
[F] ((SETF GENERIC-FUNCTION-NAME) new-name gf) |
| 267 |
|
| 268 |
(WRITER-METHOD-CLASS (class SC) (direct-slot SDSD) &rest initargs) |