docs: Small improvements to glib-mkenums man page

Clarify some typical usage of glib-mkenums and its substitutions.
This commit is contained in:
Emmanuele Bassi 2018-01-10 12:58:53 +00:00
parent e6c3060144
commit dcfa22549a

View File

@ -34,15 +34,14 @@
<refsect1><title>Description</title>
<para><command>glib-mkenums</command> is a small utility that parses C code to
extract enum definitions and produces enum descriptions based on text templates
specified by the user. Most frequently this script is used to produce C code
that contains enum values as strings so programs can provide value name strings
for introspection.
specified by the user. Typically, you can use this tool to generate enumeration
types for the GType type system, for #GObject properties and signal marshalling;
additionally, you can use it to generate enumeration values of #GSettings schemas.
</para>
<para><command>glib-mkenums</command> takes a list of valid C code files as
input. The options specified control the text that is output, certain
substitutions are performed on the text templates for keywords enclosed
in @ characters.
input. The options specified control the text that generated, substituting various
keywords enclosed in @ characters in the templates.
</para>
<refsect2><title>Production text substitutions</title>
@ -63,7 +62,7 @@ typedef enum
<listitem><para>
The name of the enum currently being processed, enum names are assumed to be
properly namespaced and to use mixed capitalization to separate
words (e.g. PrefixTheXEnum).
words (e.g. <literal>PrefixTheXEnum</literal>).
</para></listitem>
</varlistentry>
@ -71,7 +70,7 @@ words (e.g. PrefixTheXEnum).
<term>@enum_name@</term>
<listitem><para>
The enum name with words lowercase and word-separated by underscores
(e.g. prefix_the_xenum).
(e.g. <literal>prefix_the_xenum</literal>).
</para></listitem>
</varlistentry>
@ -79,7 +78,7 @@ The enum name with words lowercase and word-separated by underscores
<term>@ENUMNAME@</term>
<listitem><para>
The enum name with words uppercase and word-separated by underscores
(e.g. PREFIX_THE_XENUM).
(e.g. <literal>PREFIX_THE_XENUM</literal>).
</para></listitem>
</varlistentry>
@ -87,14 +86,14 @@ The enum name with words uppercase and word-separated by underscores
<term>@ENUMSHORT@</term>
<listitem><para>
The enum name with words uppercase and word-separated by underscores,
prefix stripped (e.g. THE_XENUM).
prefix stripped (e.g. <literal>THE_XENUM</literal>).
</para></listitem>
</varlistentry>
<varlistentry>
<term>@ENUMPREFIX@</term>
<listitem><para>
The prefix of the enum name (e.g. PREFIX).
The prefix of the enum name (e.g. <literal>PREFIX</literal>).
</para></listitem>
</varlistentry>
@ -104,7 +103,7 @@ The prefix of the enum name (e.g. PREFIX).
The enum value name currently being processed with words uppercase and
word-separated by underscores,
this is the assumed literal notation of enum values in the C sources
(e.g. PREFIX_THE_XVALUE).
(e.g. <literal>PREFIX_THE_XVALUE</literal>).
</para></listitem>
</varlistentry>
@ -114,7 +113,7 @@ this is the assumed literal notation of enum values in the C sources
A nick name for the enum value currently being processed, this is usually
generated by stripping common prefix words of all the enum values of the
current enum, the words are lowercase and underscores are substituted by a
minus (e.g. the-xvalue).
minus (e.g. <literal>the-xvalue</literal>).
</para></listitem>
</varlistentry>
@ -160,7 +159,8 @@ The name of the input file currently being processed (e.g. foo.h).
<varlistentry>
<term>@basename@</term>
<listitem><para>
The base name of the input file currently being processed (e.g. foo.h). (Since: 2.22)
The base name of the input file currently being processed (e.g. foo.h). Typically
you want to use <literal>@basename@</literal> in place of <literal>@filename@</literal> in your templates, to improve the reproducibility of the build. (Since: 2.22)
</para></listitem>
</varlistentry>
</variablelist>
@ -176,7 +176,7 @@ indicate this enum definition to be skipped, or for it to be treated as
a flags definition, or to specify the common prefix to be stripped from
all values to generate value nicknames, respectively. The "underscore_name"
option can be used to specify the word separation used in the *_get_type()
function. For instance, /*&lt; underscore_name=gnome_vfs_uri_hide_options &gt;*/.
function. For instance, <literal>/*&lt; underscore_name=gnome_vfs_uri_hide_options &gt;*/</literal>.
</para>
<para>
Per value definition, the options "skip" and "nick" are supported.