doc/*.tex: Whitespace hacking.
[sod] / doc / clang.tex
index 52e330d..e9ea08a 100644 (file)
@@ -7,7 +7,7 @@
 
 %%%----- Licensing notice ---------------------------------------------------
 %%%
-%%% This file is part of the Sensble Object Design, an object system for C.
+%%% This file is part of the Sensible Object Design, an object system for C.
 %%%
 %%% SOD is free software; you can redistribute it and/or modify
 %%% it under the terms of the GNU General Public License as published by
@@ -88,6 +88,7 @@ similar names.
 Neither generic function defines a default primary method; subclasses of
 @|c-type| must define their own methods in order to print correctly.
 
+
 \subsection{The C type root class} \label{sec:clang.c-types.root}
 
 \begin{describe}{cls}{c-type ()}
@@ -100,6 +101,7 @@ Neither generic function defines a default primary method; subclasses of
   The class @|c-type| is abstract.
 \end{describe}
 
+
 \subsection{C type S-expression notation} \label{sec:clang.c-types.sexp}
 
 The S-expression representation of a type is described syntactically as a
@@ -138,7 +140,10 @@ type specifier.  Type specifiers fit into two syntactic categories.
 \end{describe}
 
 \begin{describe}{mac}
-    {define-c-type-syntax @<name> @<lambda-list> @<form>^* @> @<name>}
+    {define-c-type-syntax @<name> @<lambda-list> \\ \ind
+      @[[ @<declaration>^* @! @<doc-string> @]] \\
+      @<form>^* \-
+     \nlret @<name>}
   Defines the symbol @<name> as a new type operator.  When a list of the form
   @|(@<name> @<argument>^*)| is used as a type specifier, the @<argument>s
   are bound to fresh variables according to @<lambda-list> (a destructuring
@@ -166,6 +171,7 @@ type specifier.  Type specifiers fit into two syntactic categories.
   default method.
 \end{describe}
 
+
 \subsection{Comparing C types} \label{sec:clang.c-types.cmp}
 
 It is necessary to compare C types for equality, for example when checking
@@ -196,6 +202,7 @@ argument lists for methods.  This is done by @|c-type-equal-p|.
   \end{describe}
 \end{describe}
 
+
 \subsection{Outputting C types} \label{sec:clang.c-types.output}
 
 \begin{describe}{gf}{pprint-c-type @<c-type> @<stream> @<kernel>}
@@ -265,7 +272,9 @@ argument lists for methods.  This is done by @|c-type-equal-p|.
 \end{describe}
 
 \begin{describe}{mac}
-    {maybe-in-parens (@<stream-var> @<guard-form>) @<form>^*}
+    {maybe-in-parens (@<stream-var> @<guard-form>)
+      @<declaration>^*
+      @<form>^*}
   The @<guard-form> is evaluated, and then the @<form>s are evaluated in
   sequence within a pretty-printer logical block writing to the stream named
   by the symbol @<stream-var>.  If the @<guard-form> evaluates to nil, then
@@ -277,6 +286,7 @@ argument lists for methods.  This is done by @|c-type-equal-p|.
   within the @<form>s.
 \end{describe}
 
+
 \subsection{Type qualifiers and qualifiable types}
 \label{sec:clang.ctypes.qual}
 
@@ -290,8 +300,8 @@ argument lists for methods.  This is done by @|c-type-equal-p|.
   qualifiers; others keywords may be used, though this isn't recommended.
 
   Two qualifiable types are equal only if they have \emph{matching
-    qualifiers}: i.e., every qualifier attached to one is also attached to
-  the other: order is not significant, and neither is multiplicity.
+  qualifiers}: i.e., every qualifier attached to one is also attached to the
+  other: order is not significant, and neither is multiplicity.
 
   The class @|qualifiable-c-type| is abstract.
 \end{describe}
@@ -317,6 +327,7 @@ argument lists for methods.  This is done by @|c-type-equal-p|.
   non-null then the final character of the returned string will be a space.
 \end{describe}
 
+
 \subsection{Leaf types} \label{sec:clang.c-types.leaf}
 
 A \emph{leaf type} is a type which is not defined in terms of another type.
@@ -350,9 +361,11 @@ In Sod, the leaf types are
   \begin{tabular}[C]{ll}                                           \hlx*{hv}
     \thd{C type}        & \thd{Specifiers}                      \\ \hlx{vhv}
     @|void|             & @|void|                               \\ \hlx{v}
-    @|char|             & @|char|                               \\ \hlx{v}
-    @|unsigned char|    & @|unsigned-char|, @|uchar|            \\ \hlx{}
-    @|signed char|      & @|signed-char|, @|schar|              \\ \hlx{v}
+    @|_Bool|            & @|bool|                               \\ \hlx{v}
+    @|char|             & @|char|                               \\ \hlx{}
+    @|wchar_t|          & @|wchar-t|                            \\ \hlx{v}
+    @|signed char|      & @|signed-char|, @|schar|              \\ \hlx{}
+    @|unsigned char|    & @|unsigned-char|, @|uchar|            \\ \hlx{v}
     @|short|            & @|short|, @|signed-short|, @|short-int|,
                           @|signed-short-int| @|sshort|         \\ \hlx{}
     @|unsigned short|   & @|unsigned-short|, @|unsigned-short-int|,
@@ -365,17 +378,26 @@ In Sod, the leaf types are
     @|unsigned long|    & @|unsigned-long|, @|unsigned-long-int|,
                           @|ulong|                              \\ \hlx{v}
     @|long long|        & @|long-long|, @|signed-long-long|,
-                          @|long-long-int|,                     \\
+                          @|long-long-int|,                     \\ \hlx{}
                         & \qquad @|signed-long-long-int|,
                           @|llong|, @|sllong|                   \\ \hlx{v}
     @|unsigned long long|
                         & @|unsigned-long-long|, @|unsigned-long-long-int|,
                           @|ullong|                             \\ \hlx{v}
+    @|size_t|           & @|size-t|                             \\ \hlx{}
+    @|ptrdiff_t|        & @|ptrdiff-t|                          \\ \hlx{v}
     @|float|            & @|float|                              \\ \hlx{}
-    @|double|           & @|double|                             \\ \hlx{v}
-    @|va_list|          & @|va-list|                            \\ \hlx{v}
-    @|size_t|           & @|size-t|                             \\ \hlx{v}
-    @|ptrdiff_t|        & @|ptrdiff-t|                          \\ \hlx*{vh}
+    @|double|           & @|double|                             \\ \hlx{}
+    @|long double|      & @|long-double|                        \\ \hlx{v}
+    @|float _Imaginary| & @|float-imaginary|                    \\ \hlx{}
+    @|double _Imaginary|& @|double-imaginary|                   \\ \hlx{}
+    @|long double _Imaginary|
+                        & @|long-double-imaginary|              \\ \hlx{v}
+    @|float _Complex|   & @|float-complex|                      \\ \hlx{}
+    @|double _Complex|  & @|double-complex|                     \\ \hlx{}
+    @|long double _Complex|
+                        & @|long-double-complex|                \\ \hlx{v}
+    @|va_list|          & @|va-list|                            \\ \hlx*{vh}
   \end{tabular}
   \caption{Builtin symbolic type specifiers for simple C types}
   \label{tab:codegen.c-types.simple}
@@ -483,6 +505,7 @@ In Sod, the leaf types are
   keywords).
 \end{describe}
 
+
 \subsection{Compound C types} \label{sec:code.c-types.compound}
 
 Some C types are \emph{compound types}: they're defined in terms of existing
@@ -494,6 +517,7 @@ protocol.
   this means depends on the class of @<c-type>.
 \end{describe}
 
+
 \subsection{Pointer types} \label{sec:clang.c-types.pointer}
 
 Pointers compound types.  The subtype of a pointer type is the type it points
@@ -526,6 +550,7 @@ to.
   interned also.
 \end{describe}
 
+
 \subsection{Array types} \label{sec:clang.c-types.array}
 
 Arrays implement the compound-type protocol.  The subtype of an array type is
@@ -567,6 +592,7 @@ the array element type.
   Returns the dimensions of @<c-type>, an array type, as an immutable list.
 \end{describe}
 
+
 \subsection{Function types} \label{sec:clang.c-types.fun}
 
 Function types implement the compound-type protocol.  The subtype of a
@@ -592,13 +618,13 @@ function type is the type of the function's return value.
   argument name.
 \end{describe}
 
-\begin{describe}{fun}{argument-name @<argument> @> @<name>}
-  Return the name of the @<argument>, as it was supplied to @|make-argument|.
-\end{describe}
-
-\begin{describe}{fun}{argument-type @<argument> @> @<c-type>}
-  Return the type of the @<argument>, as it was supplied to @|make-argument|.
-\end{describe}
+\begin{describe*}
+    {\dhead{fun}{argument-name @<argument> @> @<name>}
+     \dhead{fun}{argument-type @<argument> @> @<c-type>}}
+  Accessor functions for @|argument| objects.  They return the name (for
+  @|argument-name|) or type (for @|argument-type|) from the object, as passed
+  to @|make-argument|.
+\end{describe*}
 
 \begin{describe}{gf}
     {commentify-argument-name @<name> @> @<commentified-name>}
@@ -709,14 +735,55 @@ function type is the type of the function's return value.
   @|commentify-argument-names| to the argument list of the given type.
 \end{describe}
 
+
 \subsection{Parsing C types} \label{sec:clang.c-types.parsing}
 
+\begin{describe}{fun}
+    {parse-c-type @<scanner>
+      @> @<result> @<success-flag> @<consumed-flag>}
+\end{describe}
+
+\begin{describe}{fun}
+    {parse-declarator @<scanner> @<base-type> \&key :kernel :abstractp
+      \nlret @<result> @<success-flag> @<consumed-flag>}
+\end{describe}
+
+
+\subsection{Class types} \label{sec:clang.c-types.class}
+
+\begin{describe}{cls}
+    {c-class-type (simple-c-type) \&key :class :tag :qualifiers :name}
+\end{describe}
+
+\begin{describe*}
+    {\dhead{gf}{c-type-class @<class-type> @> @<class>}
+     \dhead{gf}{setf (c-type-class @<class-type>) @<class>}}
+\end{describe*}
+
+\begin{describe}{fun}{find-class-type @<name> @> @<class-type-or-nil>}
+\end{describe}
+
+\begin{describe}{fun}
+    {make-class-type @<name> \&optional @<qualifiers> @> @<class-type>}
+\end{describe}
+
+\begin{describe}{fun}
+    {make-class-type @<name> \&optional @<qualifiers> @> @<class-type>}
+\end{describe}
+
+\begin{describe}{fun}{find-sod-class @<name> @> @<class>}
+\end{describe}
+
+\begin{describe}{fun}{record-sod-class @<class>}
+\end{describe}
+
 %%%--------------------------------------------------------------------------
 \section{Generating C code} \label{sec:clang.codegen}
 
 This section deals with Sod's facilities for constructing and manipulating C
 expressions, declarations, instructions and definitions.
 
+
 \subsection{Temporary names} \label{sec:clang.codegen.temporaries}
 
 Many C-level objects, especially ones with external linkage or inclusion in a
@@ -791,6 +858,7 @@ Temporary names are represented by objects which implement a simple protocol.
   \label{tab:codegen.codegen.well-known-temps}
 \end{table}
 
+
 \subsection{Instructions} \label{sec:clang.codegen.insts}
 
 \begin{describe}{cls}{inst () \&key}
@@ -800,13 +868,17 @@ Temporary names are represented by objects which implement a simple protocol.
 \end{describe}
 
 \begin{describe}{mac}
-    {definst @<code> (@<streamvar> \&key @<export>) (@<arg>^*)
-      @<body-form>^*}
+    {definst @<code> (@<streamvar> \&key @<export>) (@<arg>^*) \\ \ind
+      @[[ @<declaration>^* @! @<doc-string> @]] \\
+      @<form>^* \-
+     \nlret @<code>}
 \end{describe}
 
 \begin{describe}{mac}
-    {format-compound-statement (@<stream> @<child> \&optional @<morep>)
-      @<body-form>^*}
+    {format-compound-statement
+        (@<stream> @<child> \&optional @<morep>) \\ \ind
+      @<declaration>^* \\
+      @<form>^*}
 \end{describe}
 
 \begin{table}
@@ -849,6 +921,7 @@ Temporary names are represented by objects which implement a simple protocol.
   \label{tab:codegen.codegen.insts}
 \end{table}
 
+
 \subsection{Code generation} \label{sec:clang.codegen.codegen}
 
 \begin{describe}{gf}{codegen-functions @<codegen> @> @<list>}
@@ -895,8 +968,10 @@ Temporary names are represented by objects which implement a simple protocol.
 \end{describe}
 
 \begin{describe}{mac}
-    {with-temporary-var (@<codegen> @<var> @<type>) @<body-form>^*
-      @> @<value>^*}
+    {with-temporary-var (@<codegen> @<var> @<type>) \\ \ind
+      @<declaration>^* \\
+      @<form>^* \-
+     \nlret @<value>^*}
 \end{describe}
 
 \begin{describe}{fun}{deliver-expr @<codegen> @<target> @<expr>}
@@ -927,7 +1002,6 @@ Temporary names are represented by objects which implement a simple protocol.
       \nlret @<result> @<success-flag> @<consumed-flag>}
 \end{describe}
 
-\relax
 %%%----- That's all, folks --------------------------------------------------
 
 %%% Local variables: