2 .\" Title: glib-mkenums
3 .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4 .\" Generator: DocBook XSL Stylesheets v1.74.2 <http://docbook.sf.net/>
6 .\" Manual: [FIXME: manual]
7 .\" Source: [FIXME: source]
10 .TH "GLIB\-MKENUMS" "1" "03/13/2009" "[FIXME: source]" "[FIXME: manual]"
11 .\" -----------------------------------------------------------------
12 .\" * set default formatting
13 .\" -----------------------------------------------------------------
14 .\" disable hyphenation
16 .\" disable justification (adjust text to left margin only)
18 .\" -----------------------------------------------------------------
19 .\" * MAIN CONTENT STARTS HERE *
20 .\" -----------------------------------------------------------------
22 glib-mkenums \- C language enum description generation utility
24 .HP \w'\fBglib\-mkenums\fR\ 'u
25 \fBglib\-mkenums\fR [options...] [files...]
29 is a small perl\-script 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\&.
33 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\&.
36 \fB\-\-fhead\fR \fItext\fR
40 prior to processing input files\&.
43 \fB\-\-fprod\fR \fItext\fR
47 everytime a new input file is being processed\&.
50 \fB\-\-ftail\fR \fItext\fR
54 after all input files have been processed\&.
57 \fB\-\-eprod\fR \fItext\fR
61 everytime an enum is encountered in the input files\&.
64 \fB\-\-vhead\fR \fItext\fR
68 before iterating over the set of values of an enum\&.
71 \fB\-\-vprod\fR \fItext\fR
75 for every value of an enum\&.
78 \fB\-\-vtail\fR \fItext\fR
82 after iterating over all values of an enum\&.
85 \fB\-\-comments\fR \fItext\fR
87 Template for auto\-generated comments, the default (for C code generations) is
91 \fB\-\-template\fR \fIfile\fR
93 Read templates from the given file\&. The templates are enclosed in specially\-formatted C comments
99 /*** BEGIN section ***/
100 /*** END section ***/
110 enumeration\-production,
120 Print brief help and exit\&.
125 Print version and exit\&.
127 .SS "Production text substitutions"
129 Certain keywords enclosed in @ characters will be substituted in the emitted text\&. For the substitution examples of the keywords below, the following example enum definition is assumed:
137 PREFIX_THE_XVALUE = 1 << 3,
138 PREFIX_ANOTHER_VALUE = 1 << 4
147 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)\&.
152 The enum name with words lowercase and word\-separated by underscores (e\&.g\&. prefix_the_xenum)\&.
157 The enum name with words uppercase and word\-separated by underscores (e\&.g\&. PREFIX_THE_XENUM)\&.
162 The enum name with words uppercase and word\-separated by underscores, prefix stripped (e\&.g\&. THE_XENUM)\&.
167 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)\&.
172 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)\&.
177 This is substituted either by "enum" or "flags", depending on whether the enum value definitions contained bit\-shift operators or not (e\&.g\&. flags)\&.
184 with the first letter capitalized (e\&.g\&. Flags)\&.
191 with all letters uppercased (e\&.g\&. FLAGS)\&.
196 The name of the input file currently being processed (e\&.g\&. foo\&.h)\&.
198 .SS "Trigraph extensions"
200 Some C comments are treated specially in the parsed enum definitions, such comments start out with the trigraph sequence
202 and end with the trigraph sequence
203 >*/\&. Per enum definition, the options "skip" and "flags" can be specified, to 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 "lowercase_name" option can be used to specify the word separation used in the *_get_type() function\&. For instance, /*< lowercase_name=gnome_vfs_uri_hide_options >*/\&.
205 Per value definition, the options "skip" and "nick" are supported\&. The former causes the value to be skipped, and the latter can be used to specify the otherwise auto\-generated nickname\&. Examples:
211 typedef enum /*< skip >*/
214 } PrefixThisEnumWillBeSkipped;
215 typedef enum /*< flags,prefix=PREFIX >*/
217 PREFIX_THE_ZEROTH_VALUE, /*< skip >*/
218 PREFIX_THE_FIRST_VALUE,
219 PREFIX_THE_SECOND_VALUE,
220 PREFIX_THE_THIRD_VALUE, /*< nick=the\-last\-value >*/
221 } PrefixTheFlagsEnum;
229 \fBglib\-genmarshal\fR(1)