funcsynopsis
funcsynopsis — The syntax summary for a function definition.
Synopsis
funcsynopsis ::=
- Sequence of:
info
? (db.titleforbidden.info)- One or more of:
Attributes
Additional Constraints
- If this element is the root element, it must have a version attribute.
Description
A funcsynopsis
contains the syntax summary of a
function prototype or a set of function prototypes. The content model of
this element was designed specifically to capture the semantics of most
C-language function prototypes (for use in UNIX
reference pages).
This is one of the few places where DocBook attempts to model as
well as describe. Using funcsynopsis
for languages
that are unrelated to C may prove difficult.
Processing expectations
For the most part, the processing application is expected to generate all of the parentheses, semicolons, commas, and so on required in the rendered synopsis. The exception to this rule is that the spacing and other punctuation inside a parameter that is a pointer to a function must be provided in the source markup.
With sufficient author cooperation, it should be possible to mark up a function synopsis with enough clarity so that a processing system can generate either K&R-style or ANSI-style renderings.
Attributes
Common attributes and common linking attributes.
- language
Identifies the language (i.e. programming language) of the content.
Parents
These elements contain funcsynopsis
: acknowledgements
, annotation
, answer
, appendix
, article
, bibliodiv
, bibliography
, bibliolist
, blockquote
, callout
, calloutlist
, caption
(db.caption), caution
, chapter
, colophon
, constraintdef
, cover
, dedication
, entry
, example
, figure
, footnote
, glossary
, glossdef
, glossdiv
, glosslist
, important
, index
, indexdiv
, informalexample
, informalfigure
, itemizedlist
, legalnotice
, listitem
, msgexplan
, msgtext
, note
, orderedlist
, para
, partintro
, preface
, procedure
, qandadiv
, qandaset
, question
, refsect1
, refsect2
, refsect3
, refsection
, refsynopsisdiv
, result
, revdescription
, sect1
, sect2
, sect3
, sect4
, sect5
, section
, setindex
, sidebar
, simplesect
, step
, taskprerequisites
, taskrelated
, tasksummary
, td
, textobject
, th
, tip
, toc
, tocdiv
, topic
, variablelist
, warning
.
Children
The following elements occur in funcsynopsis: funcprototype
, funcsynopsisinfo
, info
(db.titleforbidden.info).
See Also
Examples
There are two common presentation styles for function synopses, “K&R” style and “ANSI” style.
K&R Examples
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcprototype>
<?dbhtml funcsynopsis-style='kr'?>
<funcdef>int <function>max</function></funcdef>
<paramdef>int <parameter>int1</parameter></paramdef>
<paramdef>int <parameter>int2</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</article>
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcsynopsisinfo>
#include <varargs.h>
</funcsynopsisinfo>
<funcprototype>
<?dbhtml funcsynopsis-style='kr'?>
<funcdef>int <function>max</function></funcdef>
<varargs/>
</funcprototype>
</funcsynopsis>
</article>
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcprototype>
<?dbhtml funcsynopsis-style='kr'?>
<funcdef>int <function>rand</function></funcdef>
<void/>
</funcprototype>
</funcsynopsis>
</article>
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcprototype>
<?dbhtml funcsynopsis-style='kr'?>
<funcdef>void <function>qsort</function></funcdef>
<paramdef>void *<parameter>dataptr</parameter>[]</paramdef>
<paramdef>int <parameter>left</parameter></paramdef>
<paramdef>int <parameter>right</parameter></paramdef>
<paramdef>int <parameter>(* comp)</parameter>
<funcparams>void *, void *</funcparams></paramdef>
</funcprototype>
</funcsynopsis>
</article>
void qsort( | dataptr, | |
left, | ||
right, | ||
(* comp)) ; |
void * | dataptr[]; |
int | left; |
int | right; |
int (* comp)
( void *, void *) ; |
ANSI Examples
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcprototype>
<?dbhtml funcsynopsis-style='ansi'?>
<funcdef>int <function>max</function></funcdef>
<paramdef>int <parameter>int1</parameter></paramdef>
<paramdef>int <parameter>int2</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</article>
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcsynopsisinfo>
#include <varargs.h>
</funcsynopsisinfo>
<funcprototype>
<?dbhtml funcsynopsis-style='ansi'?>
<funcdef>int <function>max</function></funcdef>
<varargs/>
</funcprototype>
</funcsynopsis>
</article>
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcprototype>
<?dbhtml funcsynopsis-style='ansi'?>
<funcdef>int <function>rand</function></funcdef>
<void/>
</funcprototype>
</funcsynopsis>
</article>
<article xmlns='http://docbook.org/ns/docbook'>
<title>Example funcsynopsis</title>
<funcsynopsis>
<funcprototype>
<?dbhtml funcsynopsis-style='ansi'?>
<funcdef>void <function>qsort</function></funcdef>
<paramdef>void *<parameter>dataptr</parameter>[]</paramdef>
<paramdef>int <parameter>left</parameter></paramdef>
<paramdef>int <parameter>right</parameter></paramdef>
<paramdef>int <parameter>(* comp)</parameter>
<funcparams>void *, void *</funcparams></paramdef>
</funcprototype>
</funcsynopsis>
</article>
void qsort( | void * | dataptr[], |
int | left, | |
int | right, | |
int | (* comp)
( void *, void *) ) ; |