Commit | Line | Data |
---|---|---|
dea4d055 MW |
1 | ;;; -*-lisp-*- |
2 | ;;; | |
3 | ;;; Class finalization protocol | |
4 | ;;; | |
5 | ;;; (c) 2009 Straylight/Edgeware | |
6 | ;;; | |
7 | ||
8 | ;;;----- Licensing notice --------------------------------------------------- | |
9 | ;;; | |
10 | ;;; This file is part of the Sensble Object Design, an object system for C. | |
11 | ;;; | |
12 | ;;; SOD is free software; you can redistribute it and/or modify | |
13 | ;;; it under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 2 of the License, or | |
15 | ;;; (at your option) any later version. | |
16 | ;;; | |
17 | ;;; SOD is distributed in the hope that it will be useful, | |
18 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
23 | ;;; along with SOD; if not, write to the Free Software Foundation, | |
24 | ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
25 | ||
26 | (cl:in-package #:sod) | |
27 | ||
28 | ;;;-------------------------------------------------------------------------- | |
29 | ;;; Protocol definition. | |
30 | ||
11e41ddf | 31 | (export 'compute-cpl) |
dea4d055 MW |
32 | (defgeneric compute-cpl (class) |
33 | (:documentation | |
34 | "Returns the class precedence list for CLASS.")) | |
35 | ||
11e41ddf | 36 | (export 'compute-chains) |
dea4d055 MW |
37 | (defgeneric compute-chains (class) |
38 | (:documentation | |
39 | "Compute the layout chains for CLASS. | |
40 | ||
41 | Returns the following three values. | |
42 | ||
43 | * the head of the class's primary chain; | |
44 | ||
45 | * the class's primary chain as a list, most- to least-specific; and | |
46 | ||
47 | * the complete collection of chains, as a list of lists, each most- to | |
48 | least-specific, with the primary chain first. | |
49 | ||
50 | These values will be stored in the CHAIN-HEAD, CHAIN and CHAINS slots. | |
51 | ||
52 | If the chains are ill-formed (i.e., not distinct) then an error is | |
53 | signalled.")) | |
54 | ||
11e41ddf | 55 | (export 'check-sod-class) |
dea4d055 MW |
56 | (defgeneric check-sod-class (class) |
57 | (:documentation | |
58 | "Check the CLASS for validity. | |
59 | ||
60 | This is done as part of class finalization. The checks performed are as | |
61 | follows. | |
62 | ||
63 | * The class name and nickname, and the names of messages, obey the | |
64 | rules (see VALID-NAME-P). | |
65 | ||
66 | * The messages and slots have distinct names. | |
67 | ||
68 | * The classes in the class-precedence-list have distinct nicknames. | |
69 | ||
70 | * The chain-link is actually a proper (though not necessarily direct) | |
71 | superclass. | |
72 | ||
73 | * The chosen metaclass is actually a subclass of all of the | |
74 | superclasses' metaclasses. | |
75 | ||
76 | Returns true if all is well; false (and signals errors) if anything was | |
77 | wrong.")) | |
78 | ||
11e41ddf | 79 | (export 'finalize-sod-class) |
dea4d055 MW |
80 | (defgeneric finalize-sod-class (class) |
81 | (:documentation | |
82 | "Computes all of the gory details about a class. | |
83 | ||
84 | Once one has stopped inserting methods and slots and so on into a class, | |
85 | one needs to finalize it to determine the layout structure and the class | |
86 | precedence list and so on. More precisely that gets done is this: | |
87 | ||
88 | * Related classes (i.e., direct superclasses and the metaclass) are | |
89 | finalized if they haven't been already. | |
90 | ||
91 | * If you've been naughty and failed to store a list of slots or | |
92 | whatever, then an empty list is inserted. | |
93 | ||
94 | * The class precedence list is computed and stored. | |
95 | ||
96 | * The class is checked for compiance with the well-formedness rules. | |
97 | ||
98 | * The layout chains are computed.")) | |
99 | ||
100 | ;;;----- That's all, folks -------------------------------------------------- |