1 | /* |
---|
2 | * SlotDefinition.java |
---|
3 | * |
---|
4 | * Copyright (C) 2005 Peter Graves |
---|
5 | * $Id: SlotDefinition.java 14134 2012-08-25 21:14:49Z rschlatte $ |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU General Public License |
---|
9 | * as published by the Free Software Foundation; either version 2 |
---|
10 | * of the License, or (at your option) any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
20 | * |
---|
21 | * As a special exception, the copyright holders of this library give you |
---|
22 | * permission to link this library with independent modules to produce an |
---|
23 | * executable, regardless of the license terms of these independent |
---|
24 | * modules, and to copy and distribute the resulting executable under |
---|
25 | * terms of your choice, provided that you also meet, for each linked |
---|
26 | * independent module, the terms and conditions of the license of that |
---|
27 | * module. An independent module is a module which is not derived from |
---|
28 | * or based on this library. If you modify this library, you may extend |
---|
29 | * this exception to your version of the library, but you are not |
---|
30 | * obligated to do so. If you do not wish to do so, delete this |
---|
31 | * exception statement from your version. |
---|
32 | */ |
---|
33 | |
---|
34 | package org.armedbear.lisp; |
---|
35 | |
---|
36 | import static org.armedbear.lisp.Lisp.*; |
---|
37 | |
---|
38 | public final class SlotDefinition extends StandardObject |
---|
39 | { |
---|
40 | public SlotDefinition() |
---|
41 | { |
---|
42 | super(StandardClass.STANDARD_SLOT_DEFINITION, |
---|
43 | StandardClass.STANDARD_SLOT_DEFINITION.getClassLayout().getLength()); |
---|
44 | slots[SlotDefinitionClass.SLOT_INDEX_LOCATION] = NIL; |
---|
45 | slots[SlotDefinitionClass.SLOT_INDEX_TYPE] = T; |
---|
46 | slots[SlotDefinitionClass.SLOT_INDEX_DOCUMENTATION] = NIL; |
---|
47 | } |
---|
48 | |
---|
49 | public SlotDefinition(StandardClass clazz) { |
---|
50 | // clazz layout needs to have SlotDefinitionClass layout as prefix |
---|
51 | // or indexed slot access won't work |
---|
52 | super(clazz, clazz.getClassLayout().getLength()); |
---|
53 | slots[SlotDefinitionClass.SLOT_INDEX_LOCATION] = NIL; |
---|
54 | } |
---|
55 | |
---|
56 | public SlotDefinition(StandardClass clazz, LispObject name) { |
---|
57 | // clazz layout needs to have SlotDefinitionClass layout as prefix |
---|
58 | // or indexed slot access won't work |
---|
59 | super(clazz, clazz.getClassLayout().getLength()); |
---|
60 | slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name; |
---|
61 | slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = NIL; |
---|
62 | slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] = |
---|
63 | new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName())); |
---|
64 | slots[SlotDefinitionClass.SLOT_INDEX_READERS] = NIL; |
---|
65 | slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE; |
---|
66 | slots[SlotDefinitionClass.SLOT_INDEX_LOCATION] = NIL; |
---|
67 | slots[SlotDefinitionClass.SLOT_INDEX_TYPE] = T; |
---|
68 | slots[SlotDefinitionClass.SLOT_INDEX_DOCUMENTATION] = NIL; |
---|
69 | } |
---|
70 | |
---|
71 | public SlotDefinition(LispObject name, LispObject readers) |
---|
72 | { |
---|
73 | this(); |
---|
74 | Debug.assertTrue(name instanceof Symbol); |
---|
75 | slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name; |
---|
76 | slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = NIL; |
---|
77 | slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] = |
---|
78 | new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName())); |
---|
79 | slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers; |
---|
80 | slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE; |
---|
81 | } |
---|
82 | |
---|
83 | public SlotDefinition(LispObject name, LispObject readers, |
---|
84 | LispObject initForm) |
---|
85 | { |
---|
86 | this(); |
---|
87 | Debug.assertTrue(name instanceof Symbol); |
---|
88 | slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name; |
---|
89 | slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = NIL; |
---|
90 | slots[SlotDefinitionClass.SLOT_INDEX_INITFORM] = initForm; |
---|
91 | slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] = |
---|
92 | new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName())); |
---|
93 | slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers; |
---|
94 | slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE; |
---|
95 | } |
---|
96 | |
---|
97 | public SlotDefinition(LispObject name, LispObject readers, |
---|
98 | Function initFunction) |
---|
99 | { |
---|
100 | this(); |
---|
101 | Debug.assertTrue(name instanceof Symbol); |
---|
102 | slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name; |
---|
103 | slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = initFunction; |
---|
104 | slots[SlotDefinitionClass.SLOT_INDEX_INITFORM] = NIL; |
---|
105 | slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] = |
---|
106 | new Cons(PACKAGE_KEYWORD.intern(((Symbol)name).getName())); |
---|
107 | slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers; |
---|
108 | slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE; |
---|
109 | } |
---|
110 | |
---|
111 | public SlotDefinition(LispObject name, LispObject readers, |
---|
112 | Function initFunction, LispObject initargs) |
---|
113 | { |
---|
114 | this(); |
---|
115 | Debug.assertTrue(name instanceof Symbol); |
---|
116 | slots[SlotDefinitionClass.SLOT_INDEX_NAME] = name; |
---|
117 | slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = initFunction; |
---|
118 | slots[SlotDefinitionClass.SLOT_INDEX_INITFORM] = NIL; |
---|
119 | slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] = initargs; |
---|
120 | slots[SlotDefinitionClass.SLOT_INDEX_READERS] = readers; |
---|
121 | slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = Keyword.INSTANCE; |
---|
122 | } |
---|
123 | |
---|
124 | public static StandardObject checkSlotDefinition(LispObject obj) { |
---|
125 | if (obj instanceof StandardObject) return (StandardObject)obj; |
---|
126 | return (StandardObject)type_error(obj, Symbol.SLOT_DEFINITION); |
---|
127 | } |
---|
128 | |
---|
129 | @Override |
---|
130 | public String printObject() |
---|
131 | { |
---|
132 | StringBuilder sb = |
---|
133 | new StringBuilder(Symbol.SLOT_DEFINITION.printObject()); |
---|
134 | LispObject name = slots[SlotDefinitionClass.SLOT_INDEX_NAME]; |
---|
135 | if (name != null && name != NIL) |
---|
136 | { |
---|
137 | sb.append(' '); |
---|
138 | sb.append(name.printObject()); |
---|
139 | } |
---|
140 | return unreadableString(sb.toString()); |
---|
141 | } |
---|
142 | |
---|
143 | private static final Primitive MAKE_SLOT_DEFINITION |
---|
144 | = new pf_make_slot_definition(); |
---|
145 | @DocString(name="make-slot-definition", |
---|
146 | args="&optional class", |
---|
147 | doc="Cannot be called with user-defined subclasses of standard-slot-definition.") |
---|
148 | private static final class pf_make_slot_definition extends Primitive |
---|
149 | { |
---|
150 | pf_make_slot_definition() |
---|
151 | { |
---|
152 | super("make-slot-definition", PACKAGE_SYS, true, "&optional class"); |
---|
153 | } |
---|
154 | @Override |
---|
155 | public LispObject execute() |
---|
156 | { |
---|
157 | return new SlotDefinition(); |
---|
158 | } |
---|
159 | @Override |
---|
160 | public LispObject execute(LispObject slotDefinitionClass) |
---|
161 | { |
---|
162 | return new SlotDefinition((StandardClass) slotDefinitionClass); |
---|
163 | } |
---|
164 | }; |
---|
165 | |
---|
166 | static final Primitive _SLOT_DEFINITION_NAME |
---|
167 | = new pf__slot_definition_name(); |
---|
168 | @DocString(name="%slot-definition-name") |
---|
169 | private static final class pf__slot_definition_name extends Primitive |
---|
170 | { |
---|
171 | pf__slot_definition_name() |
---|
172 | { |
---|
173 | super(Symbol._SLOT_DEFINITION_NAME, "slot-definition"); |
---|
174 | } |
---|
175 | @Override |
---|
176 | public LispObject execute(LispObject arg) |
---|
177 | { |
---|
178 | StandardObject o = checkSlotDefinition(arg); |
---|
179 | if (o instanceof SlotDefinition) |
---|
180 | return o.slots[SlotDefinitionClass.SLOT_INDEX_NAME]; |
---|
181 | else |
---|
182 | return o.getInstanceSlotValue(Symbol.NAME); |
---|
183 | } |
---|
184 | }; |
---|
185 | |
---|
186 | private static final Primitive SET_SLOT_DEFINITION_NAME |
---|
187 | = new pf_set_slot_definition_name(); |
---|
188 | @DocString(name="set-slot-definition-name", |
---|
189 | args="slot-definition name") |
---|
190 | private static final class pf_set_slot_definition_name extends Primitive |
---|
191 | { |
---|
192 | pf_set_slot_definition_name() |
---|
193 | { |
---|
194 | super("set-slot-definition-name", PACKAGE_SYS, true, |
---|
195 | "slot-definition name"); |
---|
196 | } |
---|
197 | @Override |
---|
198 | public LispObject execute(LispObject first, LispObject second) |
---|
199 | { |
---|
200 | StandardObject o = checkSlotDefinition(first); |
---|
201 | if (o instanceof SlotDefinition) |
---|
202 | o.slots[SlotDefinitionClass.SLOT_INDEX_NAME] = second; |
---|
203 | else |
---|
204 | o.setInstanceSlotValue(Symbol.NAME, second); |
---|
205 | return second; |
---|
206 | } |
---|
207 | }; |
---|
208 | |
---|
209 | private static final Primitive _SLOT_DEFINITION_INITFUNCTION |
---|
210 | = new pf__slot_definition_initfunction(); |
---|
211 | @DocString(name="%slot-definition-initfunction") |
---|
212 | private static final class pf__slot_definition_initfunction extends Primitive |
---|
213 | { |
---|
214 | pf__slot_definition_initfunction() |
---|
215 | { |
---|
216 | super(Symbol._SLOT_DEFINITION_INITFUNCTION, "slot-definition"); |
---|
217 | } |
---|
218 | @Override |
---|
219 | public LispObject execute(LispObject arg) |
---|
220 | { |
---|
221 | StandardObject o = checkSlotDefinition(arg); |
---|
222 | if (o instanceof SlotDefinition) |
---|
223 | return o.slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION]; |
---|
224 | else |
---|
225 | return o.getInstanceSlotValue(Symbol.INITFUNCTION); |
---|
226 | } |
---|
227 | }; |
---|
228 | |
---|
229 | static final Primitive SET_SLOT_DEFINITION_INITFUNCTION |
---|
230 | = new pf_set_slot_definition_initfunction(); |
---|
231 | @DocString(name="set-slot-definition-initfunction", |
---|
232 | args="slot-definition initfunction") |
---|
233 | static final class pf_set_slot_definition_initfunction extends Primitive |
---|
234 | { |
---|
235 | pf_set_slot_definition_initfunction() |
---|
236 | { |
---|
237 | super("set-slot-definition-initfunction", PACKAGE_SYS, true, |
---|
238 | "slot-definition initfunction"); |
---|
239 | } |
---|
240 | @Override |
---|
241 | public LispObject execute(LispObject first, LispObject second) |
---|
242 | { |
---|
243 | StandardObject o = checkSlotDefinition(first); |
---|
244 | if (o instanceof SlotDefinition) |
---|
245 | o.slots[SlotDefinitionClass.SLOT_INDEX_INITFUNCTION] = second; |
---|
246 | else |
---|
247 | o.setInstanceSlotValue(Symbol.INITFUNCTION, second); |
---|
248 | return second; |
---|
249 | } |
---|
250 | }; |
---|
251 | |
---|
252 | private static final Primitive _SLOT_DEFINITION_INITFORM |
---|
253 | = new pf__slot_definition_initform(); |
---|
254 | @DocString(name="%slot-definition-initform", |
---|
255 | args="slot-definition") |
---|
256 | private static final class pf__slot_definition_initform extends Primitive |
---|
257 | { |
---|
258 | pf__slot_definition_initform() |
---|
259 | { |
---|
260 | super("%slot-definition-initform", PACKAGE_SYS, true, "slot-definition"); |
---|
261 | } |
---|
262 | @Override |
---|
263 | public LispObject execute(LispObject arg) |
---|
264 | { |
---|
265 | StandardObject o = checkSlotDefinition(arg); |
---|
266 | if (o instanceof SlotDefinition) |
---|
267 | return o.slots[SlotDefinitionClass.SLOT_INDEX_INITFORM]; |
---|
268 | else |
---|
269 | return o.getInstanceSlotValue(Symbol.INITFORM); |
---|
270 | } |
---|
271 | }; |
---|
272 | |
---|
273 | static final Primitive SET_SLOT_DEFINITION_INITFORM |
---|
274 | = new pf_set_slot_definition_initform(); |
---|
275 | @DocString(name="set-slot-definition-initform", |
---|
276 | args="slot-definition initform") |
---|
277 | static final class pf_set_slot_definition_initform extends Primitive |
---|
278 | { |
---|
279 | pf_set_slot_definition_initform() |
---|
280 | { |
---|
281 | super("set-slot-definition-initform", PACKAGE_SYS, true, |
---|
282 | "slot-definition initform"); |
---|
283 | } |
---|
284 | @Override |
---|
285 | public LispObject execute(LispObject first, LispObject second) |
---|
286 | { |
---|
287 | StandardObject o = checkSlotDefinition(first); |
---|
288 | if (o instanceof SlotDefinition) |
---|
289 | o.slots[SlotDefinitionClass.SLOT_INDEX_INITFORM] = second; |
---|
290 | else |
---|
291 | o.setInstanceSlotValue(Symbol.INITFORM, second); |
---|
292 | return second; |
---|
293 | } |
---|
294 | }; |
---|
295 | |
---|
296 | private static final Primitive _SLOT_DEFINITION_INITARGS |
---|
297 | = new pf__slot_definition_initargs(); |
---|
298 | @DocString(name="%slot-definition-initargs") |
---|
299 | private static final class pf__slot_definition_initargs extends Primitive |
---|
300 | { |
---|
301 | pf__slot_definition_initargs() |
---|
302 | { |
---|
303 | super(Symbol._SLOT_DEFINITION_INITARGS, "slot-definition"); |
---|
304 | } |
---|
305 | @Override |
---|
306 | public LispObject execute(LispObject arg) |
---|
307 | { |
---|
308 | StandardObject o = checkSlotDefinition(arg); |
---|
309 | if (o instanceof SlotDefinition) |
---|
310 | return o.slots[SlotDefinitionClass.SLOT_INDEX_INITARGS]; |
---|
311 | else |
---|
312 | return o.getInstanceSlotValue(Symbol.INITARGS); |
---|
313 | } |
---|
314 | }; |
---|
315 | |
---|
316 | static final Primitive SET_SLOT_DEFINITION_INITARGS |
---|
317 | = new pf_set_slot_definition_initargs(); |
---|
318 | @DocString(name="set-slot-definition-initargs", |
---|
319 | args="slot-definition initargs") |
---|
320 | private static final class pf_set_slot_definition_initargs extends Primitive |
---|
321 | { |
---|
322 | pf_set_slot_definition_initargs() |
---|
323 | { |
---|
324 | super("set-slot-definition-initargs", PACKAGE_SYS, true, |
---|
325 | "slot-definition initargs"); |
---|
326 | } |
---|
327 | @Override |
---|
328 | public LispObject execute(LispObject first, LispObject second) |
---|
329 | { |
---|
330 | StandardObject o = checkSlotDefinition(first); |
---|
331 | if (o instanceof SlotDefinition) |
---|
332 | o.slots[SlotDefinitionClass.SLOT_INDEX_INITARGS] = second; |
---|
333 | else |
---|
334 | o.setInstanceSlotValue(Symbol.INITARGS, second); |
---|
335 | return second; |
---|
336 | } |
---|
337 | }; |
---|
338 | |
---|
339 | private static final Primitive _SLOT_DEFINITION_READERS |
---|
340 | = new pf__slot_definition_readers(); |
---|
341 | @DocString(name="%slot-definition-readers", |
---|
342 | args="slot-definition") |
---|
343 | private static final class pf__slot_definition_readers extends Primitive { |
---|
344 | pf__slot_definition_readers() |
---|
345 | { |
---|
346 | super("%slot-definition-readers", PACKAGE_SYS, true, |
---|
347 | "slot-definition"); |
---|
348 | } |
---|
349 | @Override |
---|
350 | public LispObject execute(LispObject arg) |
---|
351 | { |
---|
352 | StandardObject o = checkSlotDefinition(arg); |
---|
353 | if (o instanceof SlotDefinition) |
---|
354 | return o.slots[SlotDefinitionClass.SLOT_INDEX_READERS]; |
---|
355 | else |
---|
356 | return o.getInstanceSlotValue(Symbol.READERS); |
---|
357 | } |
---|
358 | }; |
---|
359 | |
---|
360 | private static final Primitive SET_SLOT_DEFINITION_READERS |
---|
361 | = new pf_set_slot_definition_readers(); |
---|
362 | @DocString(name="set-slot-definition-readers", |
---|
363 | args="slot-definition readers") |
---|
364 | private static final class pf_set_slot_definition_readers extends Primitive |
---|
365 | { |
---|
366 | pf_set_slot_definition_readers() |
---|
367 | { |
---|
368 | super("set-slot-definition-readers", PACKAGE_SYS, true, |
---|
369 | "slot-definition readers"); |
---|
370 | } |
---|
371 | @Override |
---|
372 | public LispObject execute(LispObject first, LispObject second) |
---|
373 | { |
---|
374 | StandardObject o = checkSlotDefinition(first); |
---|
375 | if (o instanceof SlotDefinition) |
---|
376 | o.slots[SlotDefinitionClass.SLOT_INDEX_READERS] = second; |
---|
377 | else |
---|
378 | o.setInstanceSlotValue(Symbol.READERS, second); |
---|
379 | return second; |
---|
380 | } |
---|
381 | }; |
---|
382 | |
---|
383 | private static final Primitive _SLOT_DEFINITION_WRITERS |
---|
384 | = new pf__slot_definition_writers(); |
---|
385 | @DocString(name="%slot-definition-writers", |
---|
386 | args="slot-definition") |
---|
387 | private static final class pf__slot_definition_writers extends Primitive |
---|
388 | { |
---|
389 | pf__slot_definition_writers() |
---|
390 | { |
---|
391 | super("%slot-definition-writers", PACKAGE_SYS, true, |
---|
392 | "slot-definition"); |
---|
393 | } |
---|
394 | @Override |
---|
395 | public LispObject execute(LispObject arg) |
---|
396 | { |
---|
397 | StandardObject o = checkSlotDefinition(arg); |
---|
398 | if (o instanceof SlotDefinition) |
---|
399 | return o.slots[SlotDefinitionClass.SLOT_INDEX_WRITERS]; |
---|
400 | else |
---|
401 | return o.getInstanceSlotValue(Symbol.WRITERS); |
---|
402 | } |
---|
403 | }; |
---|
404 | |
---|
405 | private static final Primitive SET_SLOT_DEFINITION_WRITERS |
---|
406 | = new pf_set_slot_definition_writers(); |
---|
407 | @DocString(name="set-slot-definition-writers", |
---|
408 | args="slot-definition writers") |
---|
409 | private static final class pf_set_slot_definition_writers extends Primitive |
---|
410 | { |
---|
411 | pf_set_slot_definition_writers() |
---|
412 | { |
---|
413 | super("set-slot-definition-writers", PACKAGE_SYS, true, |
---|
414 | "slot-definition writers"); |
---|
415 | } |
---|
416 | @Override |
---|
417 | public LispObject execute(LispObject first, LispObject second) |
---|
418 | { |
---|
419 | StandardObject o = checkSlotDefinition(first); |
---|
420 | if (o instanceof SlotDefinition) |
---|
421 | o.slots[SlotDefinitionClass.SLOT_INDEX_WRITERS] = second; |
---|
422 | else |
---|
423 | o.setInstanceSlotValue(Symbol.WRITERS, second); |
---|
424 | return second; |
---|
425 | } |
---|
426 | }; |
---|
427 | |
---|
428 | private static final Primitive _SLOT_DEFINITION_ALLOCATION |
---|
429 | = new pf__slot_definition_allocation(); |
---|
430 | @DocString(name="%slot-definition-allocation", |
---|
431 | args="slot-definition") |
---|
432 | private static final class pf__slot_definition_allocation extends Primitive |
---|
433 | { |
---|
434 | pf__slot_definition_allocation() |
---|
435 | { |
---|
436 | super("%slot-definition-allocation", PACKAGE_SYS, true, |
---|
437 | "slot-definition"); |
---|
438 | } |
---|
439 | @Override |
---|
440 | public LispObject execute(LispObject arg) |
---|
441 | { |
---|
442 | StandardObject o = checkSlotDefinition(arg); |
---|
443 | if (o instanceof SlotDefinition) |
---|
444 | return o.slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION]; |
---|
445 | else |
---|
446 | return o.getInstanceSlotValue(Symbol.ALLOCATION); |
---|
447 | } |
---|
448 | }; |
---|
449 | |
---|
450 | private static final Primitive SET_SLOT_DEFINITION_ALLOCATION |
---|
451 | = new pf_set_slot_definition_allocation(); |
---|
452 | @DocString(name="set-slot-definition-allocation", |
---|
453 | args="slot-definition allocation") |
---|
454 | private static final class pf_set_slot_definition_allocation extends Primitive |
---|
455 | { |
---|
456 | pf_set_slot_definition_allocation() |
---|
457 | { |
---|
458 | super("set-slot-definition-allocation", PACKAGE_SYS, true, |
---|
459 | "slot-definition allocation"); |
---|
460 | } |
---|
461 | @Override |
---|
462 | public LispObject execute(LispObject first, LispObject second) |
---|
463 | { |
---|
464 | StandardObject o = checkSlotDefinition(first); |
---|
465 | if (o instanceof SlotDefinition) |
---|
466 | o.slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION] = second; |
---|
467 | else |
---|
468 | o.setInstanceSlotValue(Symbol.ALLOCATION, second); |
---|
469 | return second; |
---|
470 | } |
---|
471 | }; |
---|
472 | |
---|
473 | private static final Primitive _SLOT_DEFINITION_ALLOCATION_CLASS |
---|
474 | = new pf__slot_definition_allocation_class(); |
---|
475 | @DocString(name="%slot-definition-allocation-class", |
---|
476 | args="slot-definition") |
---|
477 | private static final class pf__slot_definition_allocation_class extends Primitive |
---|
478 | { |
---|
479 | pf__slot_definition_allocation_class() |
---|
480 | { |
---|
481 | super("%slot-definition-allocation-class", PACKAGE_SYS, true, |
---|
482 | "slot-definition"); |
---|
483 | } |
---|
484 | @Override |
---|
485 | public LispObject execute(LispObject arg) |
---|
486 | { |
---|
487 | StandardObject o = checkSlotDefinition(arg); |
---|
488 | if (o instanceof SlotDefinition) |
---|
489 | return o.slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION_CLASS]; |
---|
490 | else |
---|
491 | return o.getInstanceSlotValue(Symbol.ALLOCATION_CLASS); |
---|
492 | } |
---|
493 | }; |
---|
494 | |
---|
495 | private static final Primitive SET_SLOT_DEFINITION_ALLOCATION_CLASS |
---|
496 | = new pf_set_slot_definition_allocation_class(); |
---|
497 | @DocString(name="set-slot-definition-allocation-class", |
---|
498 | args="slot-definition allocation-class") |
---|
499 | private static final class pf_set_slot_definition_allocation_class extends Primitive |
---|
500 | { |
---|
501 | pf_set_slot_definition_allocation_class() |
---|
502 | { |
---|
503 | super("set-slot-definition-allocation-class", PACKAGE_SYS, true, |
---|
504 | "slot-definition allocation-class"); |
---|
505 | } |
---|
506 | @Override |
---|
507 | public LispObject execute(LispObject first, LispObject second) |
---|
508 | { |
---|
509 | StandardObject o = checkSlotDefinition(first); |
---|
510 | if (o instanceof SlotDefinition) |
---|
511 | o.slots[SlotDefinitionClass.SLOT_INDEX_ALLOCATION_CLASS] = second; |
---|
512 | else |
---|
513 | o.setInstanceSlotValue(Symbol.ALLOCATION_CLASS, second); |
---|
514 | return second; |
---|
515 | } |
---|
516 | }; |
---|
517 | |
---|
518 | private static final Primitive _SLOT_DEFINITION_LOCATION |
---|
519 | = new pf__slot_definition_location(); |
---|
520 | @DocString(name="%slot-definition-location") |
---|
521 | private static final class pf__slot_definition_location extends Primitive |
---|
522 | { |
---|
523 | pf__slot_definition_location() |
---|
524 | { |
---|
525 | super("%slot-definition-location", PACKAGE_SYS, true, "slot-definition"); |
---|
526 | } |
---|
527 | @Override |
---|
528 | public LispObject execute(LispObject arg) |
---|
529 | { |
---|
530 | StandardObject o = checkSlotDefinition(arg); |
---|
531 | if (o instanceof SlotDefinition) |
---|
532 | return o.slots[SlotDefinitionClass.SLOT_INDEX_LOCATION]; |
---|
533 | else |
---|
534 | return o.getInstanceSlotValue(Symbol.LOCATION); |
---|
535 | } |
---|
536 | }; |
---|
537 | |
---|
538 | static final Primitive SET_SLOT_DEFINITION_LOCATION |
---|
539 | = new pf_set_slot_definition_location(); |
---|
540 | @DocString(name="set-slot-definition-location", |
---|
541 | args="slot-definition location") |
---|
542 | private static final class pf_set_slot_definition_location extends Primitive |
---|
543 | { |
---|
544 | pf_set_slot_definition_location() |
---|
545 | { |
---|
546 | super("set-slot-definition-location", PACKAGE_SYS, true, |
---|
547 | "slot-definition location"); |
---|
548 | } |
---|
549 | @Override |
---|
550 | public LispObject execute(LispObject first, LispObject second) |
---|
551 | { |
---|
552 | StandardObject o = checkSlotDefinition(first); |
---|
553 | if (o instanceof SlotDefinition) |
---|
554 | o.slots[SlotDefinitionClass.SLOT_INDEX_LOCATION] = second; |
---|
555 | else |
---|
556 | o.setInstanceSlotValue(Symbol.LOCATION, second); |
---|
557 | return second; |
---|
558 | } |
---|
559 | }; |
---|
560 | |
---|
561 | private static final Primitive _SLOT_DEFINITION_TYPE |
---|
562 | = new pf__slot_definition_type(); |
---|
563 | @DocString(name="%slot-definition-type") |
---|
564 | private static final class pf__slot_definition_type extends Primitive |
---|
565 | { |
---|
566 | pf__slot_definition_type() |
---|
567 | { |
---|
568 | super("%slot-definition-type", PACKAGE_SYS, true, "slot-definition"); |
---|
569 | } |
---|
570 | @Override |
---|
571 | public LispObject execute(LispObject arg) |
---|
572 | { |
---|
573 | StandardObject o = checkSlotDefinition(arg); |
---|
574 | if (o instanceof SlotDefinition) |
---|
575 | return o.slots[SlotDefinitionClass.SLOT_INDEX_TYPE]; |
---|
576 | else |
---|
577 | return o.getInstanceSlotValue(Symbol._TYPE); |
---|
578 | } |
---|
579 | }; |
---|
580 | |
---|
581 | private static final Primitive SET_SLOT_DEFINITION_TYPE |
---|
582 | = new pf_set_slot_definition_type(); |
---|
583 | @DocString(name="set-slot-definition-type", |
---|
584 | args="slot-definition type") |
---|
585 | private static final class pf_set_slot_definition_type extends Primitive |
---|
586 | { |
---|
587 | pf_set_slot_definition_type() |
---|
588 | { |
---|
589 | super("set-slot-definition-type", PACKAGE_SYS, true, |
---|
590 | "slot-definition type"); |
---|
591 | } |
---|
592 | @Override |
---|
593 | public LispObject execute(LispObject first, LispObject second) |
---|
594 | { |
---|
595 | StandardObject o = checkSlotDefinition(first); |
---|
596 | if (o instanceof SlotDefinition) |
---|
597 | o.slots[SlotDefinitionClass.SLOT_INDEX_TYPE] = second; |
---|
598 | else |
---|
599 | o.setInstanceSlotValue(Symbol._TYPE, second); |
---|
600 | return second; |
---|
601 | } |
---|
602 | }; |
---|
603 | |
---|
604 | private static final Primitive _SLOT_DEFINITION_DOCUMENTATION |
---|
605 | = new pf__slot_definition_documentation(); |
---|
606 | @DocString(name="%slot-definition-documentation") |
---|
607 | private static final class pf__slot_definition_documentation extends Primitive |
---|
608 | { |
---|
609 | pf__slot_definition_documentation() |
---|
610 | { |
---|
611 | super("%slot-definition-documentation", PACKAGE_SYS, true, "slot-definition"); |
---|
612 | } |
---|
613 | @Override |
---|
614 | public LispObject execute(LispObject arg) |
---|
615 | { |
---|
616 | StandardObject o = checkSlotDefinition(arg); |
---|
617 | if (o instanceof SlotDefinition) |
---|
618 | return o.slots[SlotDefinitionClass.SLOT_INDEX_DOCUMENTATION]; |
---|
619 | else |
---|
620 | return o.getInstanceSlotValue(Symbol._DOCUMENTATION); |
---|
621 | } |
---|
622 | }; |
---|
623 | |
---|
624 | private static final Primitive SET_SLOT_DEFINITION_DOCUMENTATION |
---|
625 | = new pf_set_slot_definition_documentation(); |
---|
626 | @DocString(name="set-slot-definition-documentation", |
---|
627 | args="slot-definition documentation") |
---|
628 | private static final class pf_set_slot_definition_documentation extends Primitive |
---|
629 | { |
---|
630 | pf_set_slot_definition_documentation() |
---|
631 | { |
---|
632 | super("set-slot-definition-documentation", PACKAGE_SYS, true, |
---|
633 | "slot-definition documentation"); |
---|
634 | } |
---|
635 | @Override |
---|
636 | public LispObject execute(LispObject first, LispObject second) |
---|
637 | { |
---|
638 | StandardObject o = checkSlotDefinition(first); |
---|
639 | if (o instanceof SlotDefinition) |
---|
640 | o.slots[SlotDefinitionClass.SLOT_INDEX_DOCUMENTATION] = second; |
---|
641 | else |
---|
642 | o.setInstanceSlotValue(Symbol._DOCUMENTATION, second); |
---|
643 | return second; |
---|
644 | } |
---|
645 | }; |
---|
646 | |
---|
647 | } |
---|