X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/3a774b55edfea441c1715994924c2999e9202143..2f8a99a834db051434d30471e9cc26a41f6a5fa7:/doc/structures.tex

diff --git a/doc/structures.tex b/doc/structures.tex
index 2dfe355..a36ae82 100644
--- a/doc/structures.tex
+++ b/doc/structures.tex
@@ -444,7 +444,7 @@ vtable pointer
 In general, the vtables for the different chains will have \emph{different}
 structures.
 
-The instance layout split neatly into disjoint chains.  This is necessary
+The instance layout splits neatly into disjoint chains.  This is necessary
 because each @|ichain| must have as a prefix the @|ichain| for each
 superclass in the same chain, and each slot must be stored in exactly one
 place.  The layout of vtables doesn't have this second requirement: it
@@ -530,14 +530,14 @@ traversal.
 
 \item Let $N$ be the metaclass of $A$.  Examine the superclass chains of $N$
   in order of decreasing specificity of their most-specific classes.  Let $J$
-  be the chain head of such a chain, and let $Q$ be the most specific
-  superclass of $M$ in the same chain as $J$.  Then, if there is currently no
-  class pointer of type $Q$, then add a member
+  be the chain head of such a chain.  If there is currently no class pointer
+  for the chain headed by $J$, then add a member
   \begin{prog}
     const $Q$ *_cls_$j$;
   \end{prog}
   to the vtable pointing to the appropriate @|islots| structure within $M$'s
-  class object.
+  class object, where $Q$ is the most specific superclass of $M$ in the same
+  chain as $J$.
 
 \item Examine the superclass chains of $A$ in order of decreasing specificity
   of their most-specific classes.  Let $I$ be the chain head of such a chain.
@@ -637,13 +637,22 @@ defined for the sake of completeness.
 Finally, the class object is defined as
 \begin{prog}
   extern const struct $R$__ilayout $C$__classobj;               \\
-  \#define $C$__class (\&$C$__classobj.$j$.$r$)
+  \#define $C$__class (\&$C$__classobj.$j$.$r$)                 \\
+  \#define $C$__cls_$k$ (\&$C$__classobj.$k$.$n$)               \\
+  \quad$\vdots$
 \end{prog}
 The exported symbol @|$C$__classobj| contains the entire class instance.
 This is usually rather unwieldy.  The macro @|$C$__class| is usable as a
 pointer of type @|const $R$~*|, where $R$ is the root metaclass of $C$, i.e.,
 the metaclass of the least specific superclass of $C$; usually this is
-@|const SodClass~*|.
+@|const SodClass~*|.  For each chain of $C$'s metaclass, a macro
+@|$C$__cls_$k$| is defined, usable as a pointer of type @|const $N$~*|, where
+$K$ and $N$ are the chain's head and tail classes (i.e., the least- and
+most-specific classes in the chain) respectively; this macro is
+\emph{omitted} if $N = R$, i.e., in the common case where $C$'s metaclass is
+precisely the root metaclass, since the existing @|$C$__class| macro is
+already sufficient.
+
 
 %%%----- That's all, folks --------------------------------------------------
 
