XML technologies / DocBook / Block elements / Synopses / Function references (funcsynopsis)

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

Reference pages often need to describe functions as well as commands. The element for this is funcsynopsis. Consider the fictional function in the following example:

Example: Structure of a function reference (funcsynopsis.xml)

<funcsynopsis>
   <funcprototype>
      <?dbhtml funcsynopsis-style="..."?>
      <funcdef>int <function>foo</function></funcdef>
      <paramdef>char *<parameter>src</parameter>[]</paramdef>
      <paramdef>int <parameter>val</parameter></paramdef>
   </funcprototype>
</funcsynopsis>

Line 2: The function prototype begins with the element funcprototype.
Line 3: processing instruction for the output style; for C++, this is either kr (from Kerningham and Richie) or ansi (see the output below).
Line 4: The return value is entered directly; the function name uses function.
Line 5: Function parameters are marked with the element paramdef. The type is entered directly; the parameter name uses parameter.

The available styles are shown below:

K&R style

ANSI style

int foo (src, val); char *src [ ]; int val;

int foo (char *src [ ], int val );

For further examples, see the TDG entry for funcprototype.

  

back to top