16
28
<command>glib-mkenums</command>
17
<arg choice="opt" rep="repeat">options</arg>
18
<arg choice="opt" rep="repeat">files</arg>
29
<arg choice="opt" rep="repeat">OPTION</arg>
30
<arg choice="opt" rep="repeat">FILE</arg>
22
34
<refsect1><title>Description</title>
23
<para><command>glib-mkenums</command> is a small perl-script utility that parses C
24
code to extract enum definitions and produces enum descriptions based on text
25
templates specified by the user. Most frequently this script is used to
26
produce C code that contains enum values as strings so programs can provide
35
<para><command>glib-mkenums</command> is a small perl-script utility that
36
parses C code to extract enum definitions and produces enum descriptions based
37
on text templates specified by the user. Most frequently this script is used to
38
produce C code that contains enum values as strings so programs can provide
27
39
value name strings for introspection.
31
<refsect1><title>Invocation</title>
32
42
<para><command>glib-mkenums</command> takes a list of valid C code files as
33
input. The options specified control the text that is output, certain
34
substitutions are performed on the text templates for keywords enclosed
43
input. The options specified control the text that is output, certain
44
substitutions are performed on the text templates for keywords enclosed
38
<refsect2><title>Options</title>
42
<term><option>--fhead</option> <replaceable>text</replaceable></term>
44
Put out <replaceable>text</replaceable> prior to processing input files.
49
<term><option>--fprod</option> <replaceable>text</replaceable></term>
51
Put out <replaceable>text</replaceable> everytime a new input file
57
<term><option>--ftail</option> <replaceable>text</replaceable></term>
59
Put out <replaceable>text</replaceable> after all input files have been
65
<term><option>--eprod</option> <replaceable>text</replaceable></term>
67
Put out <replaceable>text</replaceable> everytime an enum is encountered
73
<term><option>--vhead</option> <replaceable>text</replaceable></term>
75
Put out <replaceable>text</replaceable> before iterating over the set of
81
<term><option>--vprod</option> <replaceable>text</replaceable></term>
83
Put out <replaceable>text</replaceable> for every value of an enum.
88
<term><option>--vtail</option> <replaceable>text</replaceable></term>
90
Put out <replaceable>text</replaceable> after iterating over all values
96
<term><option>--comments</option> <replaceable>text</replaceable></term>
98
Template for auto-generated comments, the default (for C code generations) is
99
<literal>"/* @comment@ */"</literal>.
104
<term><option>--template</option> <replaceable>file</replaceable></term>
106
Read templates from the given file. The templates are enclosed in
107
specially-formatted C comments
109
/*** BEGIN section ***/
110
/*** END section ***/
112
where section may be <literal>file-header</literal>,
113
<literal>file-production</literal>, <literal>file-tail</literal>,
114
<literal>enumeration-production</literal>, <literal>value-header</literal>,
115
<literal>value-production</literal>, <literal>value-tail</literal> or
116
<literal>comment</literal>.
121
<term><option>--identifier-prefix</option> <replaceable>prefix</replaceable></term>
123
Indicates what portion of the enum name should be intepreted as the
124
prefix (eg, the "<literal>Gtk</literal>" in
125
"<literal>GtkDirectionType</literal>"). Normally this will be figured
126
out automatically, but you may need to override the default if your
127
namespace is capitalized oddly.
132
<term><option>--symbol-prefix</option> <replaceable>prefix</replaceable></term>
134
Indicates what prefix should be used to correspond to the identifier
135
prefix in related C function names (eg, the "<literal>gtk</literal>"
136
in "<literal>gtk_direction_type_get_type</literal>". Equivalently,
137
this is the lowercase version of the prefix component of the enum
138
value names (eg, the "<literal>GTK</literal>" in
139
"<literal>GTK_DIR_UP</literal>". The default value is the identifier
140
prefix, converted to lowercase.
145
<term><option>--help</option></term>
147
Print brief help and exit.
152
<term><option>--version</option></term>
154
Print version and exit.
161
48
<refsect2><title>Production text substitutions</title>
163
Certain keywords enclosed in @ characters will be substituted in the
164
emitted text. For the substitution examples of the keywords below,
50
Certain keywords enclosed in @ characters will be substituted in the
51
emitted text. For the substitution examples of the keywords below,
165
52
the following example enum definition is assumed:
277
164
<refsect2><title>Trigraph extensions</title>
279
Some C comments are treated specially in the parsed enum definitions,
280
such comments start out with the trigraph sequence <literal>/*<</literal>
166
Some C comments are treated specially in the parsed enum definitions,
167
such comments start out with the trigraph sequence <literal>/*<</literal>
281
168
and end with the trigraph sequence <literal>>*/</literal>.
282
Per enum definition, the options "skip" and "flags" can be specified, to
283
indicate this enum definition to be skipped, or for it to be treated as
284
a flags definition, or to specify the common prefix to be stripped from
169
Per enum definition, the options "skip" and "flags" can be specified, to
170
indicate this enum definition to be skipped, or for it to be treated as
171
a flags definition, or to specify the common prefix to be stripped from
285
172
all values to generate value nicknames, respectively. The "underscore_name"
286
173
option can be used to specify the word separation used in the *_get_type()
287
174
function. For instance, /*< underscore_name=gnome_vfs_uri_hide_options >*/.
290
Per value definition, the options "skip" and "nick" are supported.
291
The former causes the value to be skipped, and the latter can be used to
177
Per value definition, the options "skip" and "nick" are supported.
178
The former causes the value to be skipped, and the latter can be used to
292
179
specify the otherwise auto-generated nickname.
198
<refsect1><title>Options</title>
202
<term><option>--fhead</option> <replaceable>TEXT</replaceable></term>
204
Put out <replaceable>TEXT</replaceable> prior to processing input files.
209
<term><option>--fprod</option> <replaceable>TEXT</replaceable></term>
211
Put out <replaceable>TEXT</replaceable> everytime a new input file
217
<term><option>--ftail</option> <replaceable>TEXT</replaceable></term>
219
Put out <replaceable>TEXT</replaceable> after all input files have been
225
<term><option>--eprod</option> <replaceable>TEXT</replaceable></term>
227
Put out <replaceable>TEXT</replaceable> everytime an enum is encountered
233
<term><option>--vhead</option> <replaceable>TEXT</replaceable></term>
235
Put out <replaceable>TEXT</replaceable> before iterating over the set of
241
<term><option>--vprod</option> <replaceable>TEXT</replaceable></term>
243
Put out <replaceable>TEXT</replaceable> for every value of an enum.
248
<term><option>--vtail</option> <replaceable>TEXT</replaceable></term>
250
Put out <replaceable>TEXT</replaceable> after iterating over all values
256
<term><option>--comments</option> <replaceable>TEXT</replaceable></term>
258
Template for auto-generated comments, the default (for C code generations) is
259
<literal>"/* @comment@ */"</literal>.
264
<term><option>--template</option> <replaceable>FILE</replaceable></term>
266
Read templates from the given file. The templates are enclosed in
267
specially-formatted C comments
269
/*** BEGIN section ***/
270
/*** END section ***/
272
where section may be <literal>file-header</literal>,
273
<literal>file-production</literal>, <literal>file-tail</literal>,
274
<literal>enumeration-production</literal>, <literal>value-header</literal>,
275
<literal>value-production</literal>, <literal>value-tail</literal> or
276
<literal>comment</literal>.
281
<term><option>--identifier-prefix</option> <replaceable>PREFIX</replaceable></term>
283
Indicates what portion of the enum name should be intepreted as the
284
prefix (eg, the "<literal>Gtk</literal>" in
285
"<literal>GtkDirectionType</literal>"). Normally this will be figured
286
out automatically, but you may need to override the default if your
287
namespace is capitalized oddly.
292
<term><option>--symbol-prefix</option> <replaceable>PREFIX</replaceable></term>
294
Indicates what prefix should be used to correspond to the identifier
295
prefix in related C function names (eg, the "<literal>gtk</literal>"
296
in "<literal>gtk_direction_type_get_type</literal>". Equivalently,
297
this is the lowercase version of the prefix component of the enum
298
value names (eg, the "<literal>GTK</literal>" in
299
"<literal>GTK_DIR_UP</literal>". The default value is the identifier
300
prefix, converted to lowercase.
305
<term><option>--help</option></term>
307
Print brief help and exit.
312
<term><option>--version</option></term>
314
Print version and exit.
310
321
<refsect1><title>See also</title>