3 ;;; Class finalization protocol
5 ;;; (c) 2009 Straylight/Edgeware
8 ;;;----- Licensing notice ---------------------------------------------------
10 ;;; This file is part of the Sensible Object Design, an object system for C.
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.
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.
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.
28 ;;;--------------------------------------------------------------------------
29 ;;; Protocol definition.
32 (defgeneric compute-cpl (class)
34 "Returns the class precedence list for CLASS."))
36 (export 'compute-chains)
37 (defgeneric compute-chains (class)
39 "Compute the layout chains for CLASS.
41 Returns the following three values.
43 * the head of the class's primary chain;
45 * the class's primary chain as a list, most- to least-specific; and
47 * the complete collection of chains, as a list of lists, each most- to
48 least-specific, with the primary chain first.
50 These values will be stored in the CHAIN-HEAD, CHAIN and CHAINS slots.
52 If the chains are ill-formed (i.e., not distinct) then an error is
55 (export 'guess-metaclass)
56 (defgeneric guess-metaclass (class)
58 "Determine a suitable metaclass for the CLASS.
60 The default behaviour is to choose the most specific metaclass of any of
61 the direct superclasses of CLASS, or to signal an error if that failed."))
63 (export 'check-sod-class)
64 (defgeneric check-sod-class (class)
66 "Check the CLASS for validity.
68 This is done as part of class finalization. The checks performed are as
71 * The class name and nickname, and the names of messages, obey the
72 rules (see VALID-NAME-P).
74 * The messages and slots have distinct names.
76 * The classes in the class-precedence-list have distinct nicknames.
78 * The chain-link is actually a proper (though not necessarily direct)
81 * The chosen metaclass is actually a subclass of all of the
82 superclasses' metaclasses.
84 Returns true if all is well; false (and signals errors) if anything was
87 (export 'finalize-sod-class)
88 (defgeneric finalize-sod-class (class)
90 "Computes all of the gory details about a class.
92 Once one has stopped inserting methods and slots and so on into a class,
93 one needs to finalize it to determine the layout structure and the class
94 precedence list and so on. More precisely that gets done is this:
96 * Related classes (i.e., direct superclasses and the metaclass) are
97 finalized if they haven't been already.
99 * If you've been naughty and failed to store a list of slots or
100 whatever, then an empty list is inserted.
102 * The class precedence list is computed and stored.
104 * The class is checked for compiance with the well-formedness rules.
106 * The layout chains are computed."))
108 ;;;----- That's all, folks --------------------------------------------------