Make some changes to the way that GMainContext works:
[platform/upstream/glib.git] / gobject / glib-mkenums.1
1 .TH GLIB-MKENUMS 1 "20 Apr 2001"
2 .SH NAME
3 glib-mkenums \- C language enum description generation utility
4 .SH SYNOPSIS
5
6 \fBglib-mkenums\fP [\fIoptions\fP] [\fIfiles...\fP]
7
8 .SH DESCRIPTION
9 \fBglib-mkenums\fP is a small perl-script utility that parses C code to extract enum
10 definitions and produces enum descriptions based on text templates specified
11 by the user. Most frequently this script is used to produce C code that contains
12 enum values as strings so programs can provide value name strings for introspection.
13
14 .SH INVOCATION
15
16 \fBglib-mkenums\fP takes a list of valid C code files as input. The options
17 specified controll the text that is output, certain substitutions are performed
18 on the text templates for keywords enclosed in @ characters.
19
20
21 .SS Options
22 .TP
23 \fI--fhead <text>
24 Put out <text> prior to processing input files.
25 .TP
26 \fI--fprod <text>
27 Put out <text> everytime a new input file is being processed.
28 .TP
29 \fI--ftail <text>
30 Put out <text> after all input files have been processed.
31 .TP
32 \fI--eprod <text>
33 Put out <text> everytime an enum is encountered in the input files.
34 .TP
35 \fI--vhead <text>
36 Put out <text> before iterating over the set of values of an enum.
37 .TP
38 \fI--vprod <text>
39 Put out <text> for every value of an enum.
40 .TP
41 \fI--vtail <text>
42 Put out <text> after iterating over all values of an enum.
43 .TP
44 \fI--comments <text>
45 Template for auto-generated comments, the default (for C code generations) is
46 "/* @comment@ */".
47 .TP
48 \fI-h, --help\fP 
49 Print brief help and exit.
50 .TP
51 \fI-v, --version\fP 
52 Print version and exit.
53 .PP
54
55
56 .SS Production text substitutions
57 Certain keywords enclosed in @ characters will be substituted in the outputted
58 text. For the substitution examples of the keywords below, the following example
59 enum definition is assumed:
60 .PP
61 .RS
62 .nf
63 typedef enum
64 {
65   PREFIX_THE_XVALUE    = 1 << 3,
66   PREFIX_ANOTHER_VALUE = 1 << 4
67 } PrefixTheXEnum;
68 .fi
69 .RE
70
71 .TP 12
72 \fI@EnumName@
73 The name of the enum currently being processed, enum names are assumed to be
74 properly namespaced and to use mixed capitalization to seperate
75 words (e.g. PrefixTheXEnum).
76 .TP 12
77 \fI@enum_name@
78 The enum name with words lowercase and word-seperated by underscores (e.g. prefix_the_xenum).
79 .TP 12
80 \fI@ENUMNAME@
81 The enum name with words uppercase and word-seperated by underscores (e.g. PREFIX_THE_XENUM).
82 .TP 12
83 \fI@ENUMSHORT@
84 The enum name with words uppercase and word-seperated by underscores, prefix stripped (e.g. THE_XENUM).
85 .TP 12
86 \fI@VALUENAME@
87 The enum value name currently being processed with words uppercase and word-seperated by underscores,
88 this is the assumed literal notation of enum values in the C sources (e.g. PREFIX_THE_XVALUE).
89 .TP 12
90 \fI@valuenick@
91 A nick name for the enum value currently being processed, this is usually generated by stripping
92 common prefix words of all the enum values of the current enum, the words are lowercase and
93 underscores are subsituted by a minus (e.g. the-xvalue).
94 .TP 12
95 \fI@type@
96 This is substituted either by "enum" or "flags", depending on whether the enum value definitions
97 contained bit-shift operators or not (e.g. flags).
98 .TP 12
99 \fI@Type@
100 The same as \fI@type@\fP with the first letter capitalized (e.g. Flags).
101 .TP 12
102 \fI@TYPE@
103 The same as \fI@type@\fP with all letters uppercased (e.g. FLAGS).
104 .TP 12
105 \fI@filename@
106 The name of the input file currently being processed (e.g. foo.h).
107
108 .SS Trigraph extensions
109 Some C comments are treated specially in the parsed enum definitions, such comments
110 start out with the trigraph sequence "/*<" and end with the trigraph sequence ">*/".
111 Per enum definition, the options "skip" and "flags" can be specified, to indicate
112 this enum definition to be skipped, or for it to be treated as a flags definition, or
113 to specify the common prefix to be stripped from all values to generate value nicknames,
114 respectively.
115 Per value definition, the options "skip" and "nick" are supported. The former causes the
116 value to be skipped, and the latter can be used to specify the otherwise auto-generated
117 nickname.
118 Examples:
119 .PP
120 .RS
121 .nf
122 typedef enum /*< skip >*/
123 {
124   PREFIX_FOO
125 } PrefixThisEnumWillBeSkipped;
126 typedef enum /*< flags,prefix=PREFIX >*/
127 {
128   PREFIX_THE_ZEROTH_VALUE,      /*< skip >*/
129   PREFIX_THE_FIRST_VALUE,
130   PREFIX_THE_SECOND_VALUE,
131   PREFIX_THE_THIRD_VALUE,       /*< nick=the-last-value >*/
132 } PrefixTheFlagsEnum;
133 .fi
134 .RE
135
136 .SH SEE ALSO
137 \fB
138 glib-genmarshal(1)
139 \fP
140
141 .SH BUGS 
142 None known yet.
143
144 .SH AUTHOR
145 .B glib-mkenums
146 was written by Tim Janik <timj@gtk.org> and Owen Taylor <otaylor@redhat.com>.
147 .PP
148 This manual page was provided by Tim Janik <timj@gtk.org>.