From 0dfd5c6d88810568b552fcec196e99d6a9e44f1c Mon Sep 17 00:00:00 2001
From: Mark Wooding <mdw@distorted.org.uk>
Date: Wed, 7 Aug 2019 17:26:42 +0100
Subject: [PATCH] doc/clang.tex, doc/layout.tex: Add labels and indexing for
 things in tables.

The simple C types, instruction types, and temporary names lacked
description entries.  Use the new `\desclabel' to arrange index entries
and labels.
---
 doc/clang.tex  | 39 +++++++++++++++++++++++++++++++++++++++
 doc/layout.tex |  8 ++++++++
 2 files changed, 47 insertions(+)

diff --git a/doc/clang.tex b/doc/clang.tex
index 7399258..f5ccbb1 100644
--- a/doc/clang.tex
+++ b/doc/clang.tex
@@ -501,6 +501,16 @@ In Sod, the leaf types are
   Two simple type objects are equal if and only if they have @|string=| names
   and matching qualifiers.
 
+  \def\x#1{\desclabel{const}{#1}}
+  \x{c-type-bool} \x{c-type-char} \x{c-type-wchar-t} \x{c-type-signed-char}
+  \x{c-type-unsigned-char} \x{c-type-short} \x{c-type-unsigned-short}
+  \x{c-type-int} \x{c-type-unsigned} \x{c-type-long} \x{c-type-unsigned-long}
+  \x{c-type-long-long} \x{c-type-unsigned-long-long} \x{c-type-size-t}
+  \x{c-type-ptrdiff-t} \x{c-type-float} \x{c-type-double}
+  \x{c-type-long-double} \x{c-type-float-imaginary}
+  \x{c-type-double-imaginary} \x{c-type-long-double-imaginary}
+  \x{c-type-float-complex} \x{c-type-double-complex}
+  \x{c-type-long-double-complex} \x{c-type-va-list} \x{c-type-void}
   A number of symbolic type specifiers for builtin types are predefined as
   shown in \xref{tab:codegen.c-types.simple}.  These are all defined as if by
   @|define-simple-c-type|, so can be used to construct qualified types.
@@ -1199,6 +1209,8 @@ Temporary names are represented by objects which implement a simple protocol.
 \subsubsection{Well-known `temporary' names}
 
 \begin{table}
+  \def\x#1{\desclabel{var}{#1}}
+  \x{*sod-ap*} \x{*sod-master-ap*} \x{*null-pointer*}
   \begin{tabular}[C]{*2{>{\codeface}l}}                            \hlx*{hv}
     \thd{\textbf{Variable}} & \thd{\textbf{Name format}}        \\ \hlx{vhv}
     {}*sod-ap*                  & sod__ap                       \\
@@ -1284,6 +1296,33 @@ Temporary names are represented by objects which implement a simple protocol.
   \label{tab:codegen.codegen.insts}
 \end{table}
 
+\begin{describe*}
+    {\dhead*{cls}{@<code>-inst (inst) \&key \dots}
+     \dhead*{fn}{make-@<code>-inst \dots}
+     \dhead*{gf}{inst-@<slot> @<inst> @> @<value>}}
+  \def\instclass#1#2#3{%
+    #1{cls}{#3-inst}[#2]%
+    #1{fun}{make-#3-inst}[#2]%
+  }
+  \def\instslot#1#2#3{#1{gf}{inst-#3}[#2]}
+  \def\makelabels#1#2{%
+    \def\x{\instclass{#1}{#2}}
+      \x{var} \x{set} \x{update} \x{cond} \x{return} \x{break} \x{continue}
+      \x{expr} \x{call} \x{banner} \x{block} \x{if} \x{for} \x{while}
+      \x{do-while} \x{function}
+    \def\x{\instslot{#1}{#2}}
+      \x{name} \x{type} \x{init} \x{var} \x{expr} \x{op} \x{cond} \x{conseq}
+      \x{alt} \x{func} \x{args} \x{control} \x{decls} \x{body} \x{update}
+      \x{banner} \x{banner-args}
+  }
+  \makelabels{\desclabel}{|(}
+
+  Sod provides a number of built-in instruction types generated by
+  \descref{mac}{definst}: see \xref{tab:codegen.codegen.insts}.
+
+  \makelabels{\descindex}{|)}
+\end{describe*}
+
 
 \subsection{Code generation} \label{sec:clang.codegen.codegen}
 
diff --git a/doc/layout.tex b/doc/layout.tex
index da4ee38..cdad468 100644
--- a/doc/layout.tex
+++ b/doc/layout.tex
@@ -341,9 +341,17 @@
     {\dhead{cls}{convert-to-ilayout-inst (inst)}
      \dhead{fun}
        {make-convert-to-ilayout-inst @<class> @<chain-head> @<expr>}}
+  \def\makelabels#1#2{%
+    #1{gf}{inst-class}[#2]#1{gf}{inst-chain-head}[#2]%
+    \descindex{gf}{inst-expr}[#2]%
+  }
+  \makelabels{\desclabel}{|(}
+
   \begin{prog}
     SOD_ILAYOUT(@<class>, @<chain-head-nick>, @<expr>)
   \end{prog}
+
+  \makelabels{\descindex}{|)}
 \end{describe*}
 
 
-- 
2.11.0

