glib-mkenums - C language enum description generation utility


glib-mkenums [''options''? [''files...''?


glib-mkenums 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.


glib-mkenums 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.



Put out


Put out


Put out


Put out


Put out


Put out


Put out


Template for auto-generated comments, the default (for C code generations) is

-h, --help

Print brief help and exit.

-v, --version

Print version and exit.

Production text substitutions

Certain keywords enclosed in @ characters will be substituted in the outputted text. For the substitution examples of the keywords below, the following example enum definition is assumed:

typedef enum { PREFIX_THE_XVALUE = 1


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).


The enum name with words lowercase and word-separated by underscores (e.g. prefix_the_xenum).


The enum name with words uppercase and word-separated by underscores (e.g. PREFIX_THE_XENUM).


The enum name with words uppercase and word-separated by underscores, prefix stripped (e.g. THE_XENUM).


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).


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).


This is substituted either by


The same as @type@ with the first letter capitalized (e.g. Flags).


The same as @type@ with all letters uppercased (e.g. FLAGS).


The name of the input file currently being processed (e.g. foo.h).

Trigraph extensions

Some C comments are treated specially in the parsed enum definitions, such comments start out with the trigraph sequence

typedef enum /*




None known yet.


glib-mkenums was written by Tim Janik __

This manual page was provided by Tim Janik

This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.