mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
introduce an ENUMPREFIX substitution.
2008-06-23 Kristian Rietveld <kris@imendio.com> * gobject/glib-mkenums.in: introduce an ENUMPREFIX substitution. * gio/gioenumtypes.h.template: use @ENUMPREFIX@ instead of hard coding "G" as prefix. svn path=/trunk/; revision=7096
This commit is contained in:
parent
88e007810c
commit
1289b6d165
@ -1,3 +1,10 @@
|
||||
2008-06-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gobject/glib-mkenums.in: introduce an ENUMPREFIX substitution.
|
||||
|
||||
* gio/gioenumtypes.h.template: use @ENUMPREFIX@ instead of
|
||||
hard coding "G" as prefix.
|
||||
|
||||
2008-06-22 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* glib/gurifuncs.c:
|
||||
|
@ -14,7 +14,7 @@ G_BEGIN_DECLS
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
#define G_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
|
@ -15,6 +15,7 @@ my $seenbitshift; # Have we seen bitshift operators?
|
||||
my $enum_prefix; # Prefix for this enumeration
|
||||
my $enumname; # Name for this enumeration
|
||||
my $enumshort; # $enumname without prefix
|
||||
my $enumname_prefix; # prefix of $enumname
|
||||
my $enumindex = 0; # Global enum counter
|
||||
my $firstenum = 1; # Is this the first enumeration per file?
|
||||
my @entries; # [ $name, $val ] for each entry
|
||||
@ -149,6 +150,7 @@ sub usage {
|
||||
print " \@enum_name\@ prefix_the_xenum\n";
|
||||
print " \@ENUMNAME\@ PREFIX_THE_XENUM\n";
|
||||
print " \@ENUMSHORT\@ THE_XENUM\n";
|
||||
print " \@ENUMPREFIX\@ PREFIX\n";
|
||||
print " \@VALUENAME\@ PREFIX_THE_XVALUE\n";
|
||||
print " \@valuenick\@ the-xvalue\n";
|
||||
print " \@type\@ either enum or flags\n";
|
||||
@ -361,6 +363,9 @@ while (<>) {
|
||||
$enumsym = lc $option_underscore_name;
|
||||
$enumshort = $enumlong;
|
||||
$enumshort =~ s/^[A-Z][A-Z0-9]*_//;
|
||||
|
||||
$enumname_prefix = $enumlong;
|
||||
$enumname_prefix =~ s/$enumshort$//;
|
||||
} else {
|
||||
# enumname is e.g. GMatchType
|
||||
$enspace = $enumname;
|
||||
@ -372,6 +377,10 @@ while (<>) {
|
||||
$enumshort =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
|
||||
$enumshort = uc($enumshort);
|
||||
|
||||
$enumname_prefix = $enumname;
|
||||
$enumname_prefix =~ s/^([A-Z][a-z]*).*$/$1/;
|
||||
$enumname_prefix = uc($enumname_prefix);
|
||||
|
||||
$enumlong = uc($enspace) . "_" . $enumshort;
|
||||
$enumsym = lc($enspace) . "_" . lc($enumshort);
|
||||
|
||||
@ -402,6 +411,7 @@ while (<>) {
|
||||
$prod =~ s/\@EnumName\@/$enumname/g;
|
||||
$prod =~ s/\@ENUMSHORT\@/$enumshort/g;
|
||||
$prod =~ s/\@ENUMNAME\@/$enumlong/g;
|
||||
$prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
|
||||
if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
|
||||
if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
|
||||
if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
|
||||
@ -419,6 +429,7 @@ while (<>) {
|
||||
$prod =~ s/\@EnumName\@/$enumname/g;
|
||||
$prod =~ s/\@ENUMSHORT\@/$enumshort/g;
|
||||
$prod =~ s/\@ENUMNAME\@/$enumlong/g;
|
||||
$prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
|
||||
if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
|
||||
if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
|
||||
if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
|
||||
@ -456,6 +467,7 @@ while (<>) {
|
||||
$prod =~ s/\@EnumName\@/$enumname/g;
|
||||
$prod =~ s/\@ENUMSHORT\@/$enumshort/g;
|
||||
$prod =~ s/\@ENUMNAME\@/$enumlong/g;
|
||||
$prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
|
||||
if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
|
||||
if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
|
||||
if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
|
||||
|
Loading…
Reference in New Issue
Block a user